Spaces:
Running
Running
File size: 1,712 Bytes
f51c1fd 24ee878 42c4f80 f51c1fd 42c4f80 24ee878 42c4f80 f51c1fd 24ee878 42c4f80 f51c1fd 24ee878 f51c1fd |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
"""
File: search.py
Author: Dmitry Ryumin
Description: Event handler for searching and filtering papers in the Gradio app.
License: MIT License
"""
import gradio as gr
from pathlib import Path
# Importing necessary components for the Gradio app
from app.config import config_data
from app.components import html_message, video_create_ui, button
def event_handler_files(files):
if not files:
return (
html_message(config_data.InformationMessages_NOTI_VIDEOS, False),
video_create_ui(),
button(
config_data.OtherMessages_CALCULATE_PT_SCORES,
False,
3,
"./images/calculate_pt_scores.ico",
True,
"calculate_oceanai",
),
button(
config_data.OtherMessages_CLEAR_APP,
False,
1,
"./images/clear.ico",
True,
"clear_oceanai",
),
)
return (
html_message(config_data.OtherMessages_NOTI_CALCULATE, True),
video_create_ui(value=files[0], file_name=Path(files[0]).name),
button(
config_data.OtherMessages_CALCULATE_PT_SCORES,
True,
3,
"./images/calculate_pt_scores.ico",
True,
"calculate_oceanai",
),
button(
config_data.OtherMessages_CLEAR_APP,
True,
1,
"./images/clear.ico",
True,
"clear_oceanai",
),
)
def event_handler_files_select(files, evt: gr.SelectData):
return video_create_ui(value=files[evt.index], file_name=evt.value)
|