File size: 840 Bytes
0eb933f
76edd3a
 
0eb933f
76edd3a
 
 
 
56393bf
76edd3a
 
 
 
f0ab7ff
76edd3a
 
f0ab7ff
76edd3a
 
0eb933f
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import gradio as gr
from huggingface_hub import HfApi
import os

TOKEN = os.environ.get("DEBUG")
API = HfApi(token=TOKEN)

def update(name):
    API.restart_space("EnergyStarAI/launch-computation-example")  
    return f"Okay! EnergyStarAI/launch-computation-example should be running now!"

with gr.Blocks() as demo:
    gr.Markdown("This is a super basic example 'frontend'. Start typing below and then click **Run** to launch the job.")
    gr.Markdown("The job will be launched at [EnergyStarAI/launch-computation-example](https://huggingface.co/spaces/EnergyStarAI/launch-computation-example)")
    with gr.Row():
        inp = gr.Textbox(placeholder="Textfields/dropdowns/etc for different options would go here.")
        out = gr.Markdown()
    btn = gr.Button("Run")
    btn.click(fn=update, inputs=inp, outputs=out)

demo.launch()