Spaces:
Running
Running
File size: 431 Bytes
f045267 |
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
def run():
process = subprocess.Popen(your_command, 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()
|