lainlives commited on
Commit
eb6a024
·
verified ·
1 Parent(s): 01bca4d

Upload folder using huggingface_hub

Browse files
Files changed (2) hide show
  1. README.md +2 -4
  2. app.py +24 -0
README.md CHANGED
@@ -1,6 +1,6 @@
1
  ---
2
- title: Starter
3
- emoji: 🐠
4
  colorFrom: yellow
5
  colorTo: red
6
  sdk: gradio
@@ -8,5 +8,3 @@ sdk_version: 6.9.0
8
  app_file: app.py
9
  pinned: false
10
  ---
11
-
12
- Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
 
1
  ---
2
+ title: Restarter
3
+ emoji: 🐢
4
  colorFrom: yellow
5
  colorTo: red
6
  sdk: gradio
 
8
  app_file: app.py
9
  pinned: false
10
  ---
 
 
app.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import os
3
+ from time import sleep
4
+ from huggingface_hub.HfApi import pause_space, restart_space
5
+
6
+
7
+ HF_TOKEN = os.getenv("HF_TOKEN")
8
+
9
+ SELF = "lainlives/starter"
10
+ HELPER = "lainlives/restarter"
11
+
12
+ # --- Gradio Interface ---
13
+ with gr.Blocks() as demo:
14
+ gr.Markdown("## Online")
15
+
16
+
17
+ if __name__ == "__main__":
18
+ pause_space(repo_id=HELPER)
19
+ sleep(10)
20
+ restart_space(repo_id=HELPER, token=HF_TOKEN, factory_reboot=True)
21
+ pause_space(repo_id=SELF)
22
+ demo.launch(server_name="0.0.0.0", server_port=7860)
23
+ #
24
+ #