If you can't see the images please make sure you are signed in to your Twinkl account on Google & you have access to the Shared Drives you are searching :)
To drag images click 'Make Draggable' button and wait until it says 'Drag It!'. After this you can drag the image into a folder on your computer
")
gr.HTML(ill_check_html)
user_num = gr.Number(value = 0, label = 'Put lowest number of the alarm clock you can see')
with gr.Row():
with gr.Column(min_width = 0):
search_prompt = gr.Textbox(placeholder = 'search for an illustration', label = 'Search', elem_id = 'search_term')
title_search = gr.Checkbox(label = 'Search title only')
with gr.Column(min_width = 0):
shared_drive = gr.Dropdown(choices = ['Illustrations - 01-10 to 07-22', 'Illustrations - Now', 'Shutter Stock Images', 'Beyond - Illustrations', 'DO NOT USE IN GENERAL RESOURCES - South Africa', 'Australia - Rhino Readers Illustrations', 'Aus and Nz - Phonics Illustrations', 'Twinkl Art Gallery'], multiselect = True, label = 'Shared Drive', value = ['Illustrations - 01-10 to 07-22', 'Illustrations - Now'])
with gr.Column(min_width = 0):
key_stage = gr.Dropdown(choices = ['EYFS', 'KS1', 'KS2', 'KS3'], multiselect = True, label = 'Key Stage', value = ['EYFS', 'KS1', 'KS2', 'KS3'])
with gr.Column(min_width = 0):
image_type = gr.Dropdown(choices = ['JPEG', 'PNG', 'TIF', 'TIFF'], multiselect = True, label = 'Image Type', value = ['PNG', 'JPEG', 'TIF', 'TIFF'])
with gr.Column(min_width = 0):
sort_by = gr.Dropdown(choices = ['Relevance', 'Date Created', 'A-Z'], value = 'Relevance', multiselect = False, label = 'Sort By')
max_return = gr.Dropdown(choices = ['10', '25', '50', '75', '100', '250', '500', '1000', '5000', '10000', 'All'], value = '50', multiselect = False, label = 'No. of Results to Return (Total: 0)')
with gr.Row():
search_button = gr.Button(value="Search!", interactive = True)
with gr.Row():
output_df = gr.HTML()
back_top_btn = gr.HTML(back_to_top_btn_html)
load_more_results_btn = gr.Button(value = 'Load More Results', interactive = True, visible = False)
search_button.click(search_index, inputs=[search_prompt, shared_drive, key_stage, sort_by, max_return, user_num, title_search, image_type], outputs=[output_df, max_return, load_more_results_btn])
search_prompt.submit(search_index, inputs=[search_prompt, shared_drive, key_stage, sort_by, max_return, user_num, title_search, image_type], outputs=[output_df, max_return, load_more_results_btn])
search_button.click(search_logging, inputs=[search_prompt], outputs=None)
search_prompt.submit(search_logging, inputs=[search_prompt], outputs=None)
load_more_results_btn.click(search_index, inputs=[search_prompt, shared_drive, key_stage, sort_by, max_return, user_num, title_search, image_type, load_more_results_btn], outputs=[output_df, max_return, load_more_results_btn])
app.load()
app.auth = (same_auth)
app.auth_message = ''
fapi = FastAPI()
fapi.add_middleware(SessionMiddleware, secret_key=os.environ['session_key'])
@fapi.middleware("http")
async def add_session_hash(request: Request, call_next):
response = await call_next(request)
session = request.cookies.get('session')
if session:
response.set_cookie(key='session', value=request.cookies.get('session'), httponly=True)
return response
# custom get request handler with params to flag clicks
@ fapi.get("/track")
async def track(url: str, q: str, request: Request):
if q is None:
q = ''
# logger.flag([url, q, request.cookies['access-token'], str(datetime.now())])
return {"message": "ok"}
# mount Gradio app to FastAPI app
app2 = gr.mount_gradio_app(fapi, app, path="/", allowed_paths = ["."], auth = same_auth)
# serve the app
if __name__ == "__main__":
uvicorn.run(app2, host="0.0.0.0", port=7860)