Spaces:
Runtime error
Runtime error
#!/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() | |