starter.old / app.py
lainlives's picture
Upload folder using huggingface_hub
eb6a024 verified
raw
history blame contribute delete
527 Bytes
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)
#
#