File size: 737 Bytes
e51e8f8
 
 
 
77df2c6
 
e51e8f8
77df2c6
 
e51e8f8
 
 
77df2c6
e51e8f8
77df2c6
 
e51e8f8
77df2c6
 
 
 
 
e51e8f8
 
 
58113ed
e51e8f8
 
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
#!/usr/bin/env python

from __future__ import annotations

import os

import gradio as gr
from apscheduler.schedulers.background import BackgroundScheduler
from huggingface_hub import HfApi

from demo_list import DemoList

INTERVAL_MIN = int(os.getenv('INTERVAL_MIN', '10'))

demo_list = DemoList()
api = HfApi()

scheduler = BackgroundScheduler()
scheduler.add_job(func=lambda: api.restart_space('hysts/list-of-demos'),
                  trigger='interval',
                  seconds=60 * INTERVAL_MIN)
scheduler.start()

with gr.Blocks(css='style.css') as demo:
    df = gr.Dataframe(value=demo_list.df,
                      datatype=demo_list.column_datatype,
                      type='pandas')
demo.queue(api_open=False).launch()