Spaces:
Running
Running
import subprocess | |
import sys | |
import gradio as gr | |
def run(): | |
process = subprocess.Popen(["python", "run.py"], stdout=subprocess.PIPE) | |
logs = "" | |
for line in iter(process.stdout.readline, b""): | |
logs += "\n" + line.decode() | |
yield logs | |
with gr.Blocks() as demo: | |
button = gr.Button("Run") | |
output_textbox = gr.Textbox() | |
button.click(run, outputs=[output_textbox]) | |
if __name__ == "__main__": | |
demo.launch(server_name="0.0.0.0", server_port=7860) | |