import atexit | |
import gradio as gr | |
from app_debug import get_demo as get_demo_debug | |
from app_leaderboard import get_demo as get_demo_leaderboard | |
from app_text_classification import get_demo as get_demo_text_classification | |
from run_jobs import start_process_run_job, stop_thread | |
try: | |
with gr.Blocks(theme=gr.themes.Soft(primary_hue="green")) as demo: | |
with gr.Tab("Text Classification"): | |
get_demo_text_classification() | |
with gr.Tab("Leaderboard") as leaderboard_tab: | |
get_demo_leaderboard(leaderboard_tab) | |
with gr.Tab("Logs(Debug)"): | |
get_demo_debug() | |
start_process_run_job() | |
demo.queue(max_size=1000) | |
demo.launch(share=False) | |
atexit.register(stop_thread) | |
except Exception as e: | |
print("stop background thread: ", e) | |
stop_thread() | |