list-of-demos / app.py
hysts's picture
hysts HF staff
Update
71820c0
raw
history blame
No virus
737 Bytes
#!/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(os.getenv('SPACE_ID')),
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()