uv run --with gradio gui.py
Created
July 1, 2025 16:22
-
-
Save rochacbruno/bd0698651a9d3607bfd0566e95b0faa6 to your computer and use it in GitHub Desktop.
Simple Deployer with Gradio
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
import gradio as gr | |
steps = ["generate", "build", "scan", "provision", "config"] | |
def deploy(image: str, progress=gr.Progress(track_tqdm=True)): | |
"""Simulate a long running task to deploy an image""" | |
yield f"starting deploy for {image}" | |
for step in progress.tqdm(steps): | |
time.sleep(1) | |
yield f"processing {step}" | |
progress(100, desc="finished") | |
yield f"deploy for {image} finished" | |
with gr.Blocks(title="test") as gui: | |
with gr.Row(): | |
with gr.Column(): | |
image = gr.Textbox(label="image") | |
with gr.Column(): | |
current = gr.Label(label="current step") | |
progress = gr.Label(label="progress") | |
with gr.Row(): | |
run = gr.Button("Deploy") | |
run.click( | |
fn=deploy, | |
inputs=[image], | |
outputs=current, | |
show_progress=True, | |
show_progress_on=progress, | |
) | |
gui.launch(share=False, quiet=False) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment