File size: 994 Bytes
4b2522c
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
import gradio as gr
from apscheduler.schedulers.background import BackgroundScheduler
from src.static.env import API, REPO_ID, HF_TOKEN
from src.static.about import TITLE, INTRO, ABOUT

from src.leaderboards.get_from_hub import get_leaderboard_info


def restart_space():
    API.restart_space(repo_id=REPO_ID, token=HF_TOKEN)

leaderboards_to_info, info_to_leaderboards = get_leaderboard_info()


demo = gr.Blocks()
with demo:
    gr.HTML(TITLE)
    gr.Markdown(INTRO, elem_classes="markdown-text")

    with gr.Tabs(elem_classes="tab-buttons") as tabs:
        with gr.TabItem("Search"):
            gr.Markdown("Let's look for leaderboards relevant for you! Select the categories of your choice")
            


        with gr.TabItem("About"):
            gr.Markdown(ABOUT, elem_classes="markdown-text")

scheduler = BackgroundScheduler()
scheduler.add_job(restart_space, "interval", seconds=10800) # restarted every 3h
scheduler.start()

demo.queue(default_concurrency_limit=40).launch()