Spaces:
Runtime error
Runtime error
File size: 527 Bytes
eb6a024 | 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 | import gradio as gr
import os
from time import sleep
from huggingface_hub.HfApi import pause_space, restart_space
HF_TOKEN = os.getenv("HF_TOKEN")
SELF = "lainlives/starter"
HELPER = "lainlives/restarter"
# --- Gradio Interface ---
with gr.Blocks() as demo:
gr.Markdown("## Online")
if __name__ == "__main__":
pause_space(repo_id=HELPER)
sleep(10)
restart_space(repo_id=HELPER, token=HF_TOKEN, factory_reboot=True)
pause_space(repo_id=SELF)
demo.launch(server_name="0.0.0.0", server_port=7860)
#
# |