lhoestq HF Staff commited on
Commit
f045267
·
verified ·
1 Parent(s): 5afa722

Create gradio.app

Browse files
Files changed (1) hide show
  1. gradio.app +20 -0
gradio.app ADDED
@@ -0,0 +1,20 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import subprocess
2
+ import sys
3
+
4
+ import gradio
5
+
6
+
7
+ def run():
8
+ process = subprocess.Popen(your_command, stdout=subprocess.PIPE)
9
+ logs = ""
10
+ for line in iter(process.stdout.readline, b""):
11
+ logs += "\n" + line.decode
12
+ yield logs
13
+
14
+ with gr.Blocks() as demo:
15
+ button = gr.Button("Run")
16
+ output_textbox = gr.Textbox()
17
+ button.click(run, outputs=[output_textbox])
18
+
19
+ if __name__ == "__main__":
20
+ demo.launch()