Skip to content

Commit

Permalink
Updated AI Models (BREAKING CHANGE UPDATE ULTRALYTICS TO USE),
Browse files Browse the repository at this point in the history
Added Yandex Search Engine, Other optimizations
  • Loading branch information
EngMarchG committed Nov 25, 2023
1 parent 1e1c77c commit 0104e12
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions Fsg_pp.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand All @@ -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:
Expand Down Expand Up @@ -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()

0 comments on commit 0104e12

Please sign in to comment.