File size: 479 Bytes
f045267
 
 
6017ce1
f045267
 
 
e133235
f045267
 
bdb8322
f045267
 
 
 
 
 
 
 
0e9dbb1
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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 += 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)