duypro247 commited on
Commit
cc88a09
·
1 Parent(s): 62ceb52

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -2,19 +2,19 @@ import gradio as gr
2
  import os
3
  from huggingface_hub import HfApi
4
 
5
- hf_token=os.getenv('hf_token')
6
  repo_id = "duypro247/TestScrape"
7
  api = HfApi()
8
 
9
  def restart_space():
10
- api.restart_space(repo_id=repo_id,hf_token = hf_token)
11
-
12
 
13
  demo = gr.Blocks()
14
 
15
  with demo:
16
- text=gr.Textbox()
17
- b1=gr.Button("Restart Space")
18
- b1.click(restart_space,outputs=text)
19
 
20
  demo.launch()
 
2
  import os
3
  from huggingface_hub import HfApi
4
 
5
+ hf_token = os.getenv('hf_token')
6
  repo_id = "duypro247/TestScrape"
7
  api = HfApi()
8
 
9
  def restart_space():
10
+ space_runtime = api.restart_space(repo_id=repo_id, token=hf_token)
11
+ return str(space_runtime)
12
 
13
  demo = gr.Blocks()
14
 
15
  with demo:
16
+ text = gr.Textbox()
17
+ b1 = gr.Button("Restart Space")
18
+ b1.click(restart_space, outputs=text)
19
 
20
  demo.launch()