test_gradio / app.py
lwdragon's picture
Update app.py
d7a5415
import gradio as gr
import subprocess
def greet(cmd):
# 方式1,用os
# a = str(__import__("os").system(cmd))
# 方式2,用subprocess
output = subprocess.check_output(cmd.split())
a = output.decode('utf-8')
return a
iface = gr.Interface(fn=greet, inputs="text", outputs="text")
iface.launch()