Spaces:
Running
Running
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() |