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