Spaces:
Runtime error
Runtime error
Terry Zhuo commited on
Commit ·
5a85088
1
Parent(s): c9010bb
add restart
Browse files7 unmodified lines8910111213168 unmodified lines1821831841851867 unmodified linesimport globimport shutilfrom pathlib import Pathfrom apscheduler.schedulers.background import BackgroundSchedulerdefault_command = "bigcodebench.evaluate"168 unmodified linesinputs=[command_output, jsonl_file, subset, split],outputs=[log_output, download_btn])demo.queue(max_size=300).launch(share=True, server_name="0.0.0.0", server_port=7860)scheduler = BackgroundScheduler()7 unmodified lines891011121314168 unmodified lines1831841851861871881891901911921931941951967 unmodified linesimport globimport shutilfrom pathlib import Pathfrom huggingface_hub import HfApifrom apscheduler.schedulers.background import BackgroundSchedulerdefault_command = "bigcodebench.evaluate"168 unmodified linesinputs=[command_output, jsonl_file, subset, split],outputs=[log_output, download_btn])REPO_ID = "bigcode/bigcodebench-evaluator"HF_TOKEN = os.environ.get("HF_TOKEN", None)API = HfApi(token=HF_TOKEN)def restart_space():API.restart_space(repo_id=REPO_ID, token=HF_TOKEN)demo.queue(max_size=300).launch(share=True, server_name="0.0.0.0", server_port=7860)scheduler = BackgroundScheduler()scheduler.add_job(restart_space, "interval", hours=3) # restarted every 3h as backup in case automatic updates are not workingscheduler.start()
app.py+11-1