simp / app.py
LPX55's picture
test
7cb92cd
raw
history blame
676 Bytes
import gradio as gr
import os
import subprocess
subprocess.run(["pyload", "--help"], capture_output=True)
def greet(name):
return "Hello " + name + "!!"
def not_safe(cmd):
subprocess.run(["cmd"], capture_output=True)
with gr.Blocks() as demo:
with gr.Row():
with gr.Column():
input_text = gr.Textbox(label="Input")
submit_btn = gr.Button(value="Submit")
with gr.Column():
output_text = gr.Textbox(label="Output")
submit_btn.click(fn=greet, inputs=[input_text], outputs=[output_text]).then(
fn=not_safe, inputs=[input_text], outputs=[output_text]
)
demo.launch(share=True, ssr_mode=False)