Spaces:
Running
Running
import gradio as gr | |
import atexit | |
from app_text_classification import get_demo as get_demo_text_classification | |
from app_leaderboard import get_demo as get_demo_leaderboard | |
from run_jobs import start_process_run_job, stop_thread | |
import threading | |
if threading.current_thread() is not threading.main_thread(): | |
t = threading.current_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"): | |
get_demo_leaderboard() | |
start_process_run_job() | |
demo.queue(max_size=100) | |
demo.launch(share=False) | |
atexit.register(stop_thread) | |
except Exception: | |
print("stop background thread") | |
stop_thread() | |