From 0104e12ded1b16c862f0662d55005615db52028b Mon Sep 17 00:00:00 2001 From: EngMarchG Date: Sat, 25 Nov 2023 17:38:58 +0100 Subject: [PATCH] Updated AI Models (BREAKING CHANGE UPDATE ULTRALYTICS TO USE), Added Yandex Search Engine, Other optimizations --- Fsg_pp.py | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) diff --git a/Fsg_pp.py b/Fsg_pp.py index a428292..f25ef1b 100644 --- a/Fsg_pp.py +++ b/Fsg_pp.py @@ -9,6 +9,7 @@ from sites.pixiv import getOrderedPixivImages from sites.danbooru import getOrderedDanbooruImages from sites.zerochan import getOrderedZerochanImages +from sites.yandex import getOrderedYandexImages def pix_imgs(searchQuery, num_pics, num_pages,searchTypes,viewRestriction,imageControl,n_likes, n_bookmarks, n_views, start_date, end_date, user_name, pass_word): @@ -33,6 +34,13 @@ def zero_imgs(searchQuery, num_pics, num_pages, n_likes, filters,imageControl): print(imgz) return imgz if imgz else [] +def yandex_imgs(searchQuery, num_pics, filters,imageOrientation): + global imgz + driver = driver_instance.create_driver() + imgz = getOrderedYandexImages(driver=driver, exec_path=exec_path, user_search=searchQuery, num_pics=num_pics, filters=filters,imageOrientation=imageOrientation) + print(imgz) + return imgz if imgz else [] + def open_folder(folder_path, mode=0): folder_opened = os.path.abspath(folder_path) if mode: @@ -184,6 +192,31 @@ def cropImages(image,crop_scale_factor): gallery.select(get_select_index, None, selected) green_btn.click(zero_imgs, [searchQuery, num_pics, num_pages, n_likes, filters,imageControl], outputs=gallery) + # Yandex Tab + with gr.TabItem("Yandex", id=4): + with gr.Row(): + with gr.Column(): + searchQuery = gr.Textbox(label="Search Query", placeholder="Suggested to use the char's full name") + with gr.Row(): + num_pics = gr.Slider(1,30, value=2, step=int, label="Number of Pictures") + with gr.Row(): + with gr.Row(): + filters = gr.CheckboxGroup(["AI Classifier","Search By Recent"], label="Filters", type="index",elem_id="zeroAIhover") + with gr.Column(): + imageOrientation = gr.Radio(["Landscape","Portrait","Square"], label="Image Orientation", type="index", elem_id="imageControl") + green_btn = gr.Button(value="Search") + + with gr.Column(): + gallery=gr.Gallery(label="Image Preview", preview=True, object_fit="cover", container=True, columns=5) + + with gr.Row(): + blue_btn = gr.Button(value="Crop Selected Image",variant='secondary') + blue_btn.click(fn=send_number,inputs=selected,outputs=[image,tabs]) + open_btn = gr.Button(value="Open 📁",variant='secondary') + open_btn.click(fn=open_folder, inputs=folder_input) + + gallery.select(get_select_index, None, selected) + green_btn.click(yandex_imgs, [searchQuery, num_pics, filters,imageOrientation], outputs=gallery) demo.launch() \ No newline at end of file