File size: 752 Bytes
0eb933f
76edd3a
 
0eb933f
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/backend_test")  
    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 launches at EnergyStarAI/launch-computation-example")
    with gr.Row():
        inp = gr.Textbox(placeholder="Textfields/dropdowns/etc for different options would go here.")
        out = gr.Textbox()
    btn = gr.Button("Run")
    btn.click(fn=update, inputs=inp, outputs=out)

demo.launch()