meg HF staff commited on
Commit
76edd3a
·
verified ·
1 Parent(s): 0eb933f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +17 -3
app.py CHANGED
@@ -1,7 +1,21 @@
1
  import gradio as gr
 
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
 
 
 
 
 
 
 
 
 
 
 
 
 
5
 
6
- demo = gr.Interface(fn=greet, inputs="text", outputs="text")
7
  demo.launch()
 
1
  import gradio as gr
2
+ from huggingface_hub import HfApi
3
+ import os
4
 
5
+ TOKEN = os.environ.get("DEBUG")
6
+ API = HfApi(token=TOKEN)
7
+
8
+ def update(name):
9
+ API.restart_space("EnergyStarAI/backend_test")
10
+ return f"Okay! EnergyStarAI/launch-computation-example should be running now!"
11
+
12
+ with gr.Blocks() as demo:
13
+ gr.Markdown("This is a super basic example 'frontend'. Start typing below and then click **Run** to launch the job.")
14
+ gr.Markdown("The job will be launches at EnergyStarAI/launch-computation-example")
15
+ with gr.Row():
16
+ inp = gr.Textbox(placeholder="Textfields/dropdowns/etc for different options would go here.")
17
+ out = gr.Textbox()
18
+ btn = gr.Button("Run")
19
+ btn.click(fn=update, inputs=inp, outputs=out)
20
 
 
21
  demo.launch()