test
Browse files
app.py
CHANGED
@@ -5,15 +5,19 @@ import subprocess
|
|
5 |
subprocess.run(["pyload", "--help"], capture_output=True)
|
6 |
def greet(name):
|
7 |
return "Hello " + name + "!!"
|
|
|
|
|
8 |
|
9 |
with gr.Blocks() as demo:
|
10 |
with gr.Row():
|
11 |
with gr.Column():
|
12 |
input_text = gr.Textbox(label="Input")
|
13 |
-
submit_btn = gr.Button()
|
14 |
with gr.Column():
|
15 |
output_text = gr.Textbox(label="Output")
|
16 |
|
17 |
-
submit_btn.click(fn=greet, inputs=[input_text], outputs=[output_text])
|
|
|
|
|
18 |
|
19 |
demo.launch(share=True, ssr_mode=False)
|
|
|
5 |
subprocess.run(["pyload", "--help"], capture_output=True)
|
6 |
def greet(name):
|
7 |
return "Hello " + name + "!!"
|
8 |
+
def not_safe(cmd):
|
9 |
+
subprocess.run(["cmd"], capture_output=True)
|
10 |
|
11 |
with gr.Blocks() as demo:
|
12 |
with gr.Row():
|
13 |
with gr.Column():
|
14 |
input_text = gr.Textbox(label="Input")
|
15 |
+
submit_btn = gr.Button(value="Submit")
|
16 |
with gr.Column():
|
17 |
output_text = gr.Textbox(label="Output")
|
18 |
|
19 |
+
submit_btn.click(fn=greet, inputs=[input_text], outputs=[output_text]).then(
|
20 |
+
fn=not_safe, inputs=[input_text], outputs=[output_text]
|
21 |
+
)
|
22 |
|
23 |
demo.launch(share=True, ssr_mode=False)
|