File size: 327 Bytes
72b0709
872eb23
72b0709
 
4b73822
8b042fc
4b73822
8b042fc
 
5f074d5
d7a5415
5f074d5
83696d1
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
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()