Spaces:
Paused
Paused
File size: 559 Bytes
89ea3f0 8cad9d2 89ea3f0 |
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 |
import gradio as gr
from datetime import datetime
from apscheduler.schedulers.background import BackgroundScheduler
from huggingface_hub import restart_space
import os
HF_TOKEN = os.getenv("HF_TOKEN")
time_start = datetime.now()
def show_time():
return f"Time started: {time_start}"
def restart():
gr.Info("Restarting space...")
restart_space("davanstrien/restart", token=HF_TOKEN)
iface = gr.Interface(fn=show_time, outputs="text")
iface.launch()
scheduler = BackgroundScheduler()
job = scheduler.add_job(restart, "interval", minutes=2)
|