Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,21 @@
|
|
| 1 |
import gradio as gr
|
|
|
|
|
|
|
| 2 |
|
| 3 |
-
|
| 4 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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()
|