Team Ai
Apppublic

quanvndzai/PythonTerm

sourceHugging Faceupdated 4y agoView on Hugging Face
5likes
app.py21 linesDownload Raw Back to root
1import gradio as gr2import subprocess3import shlex4 5def execute_command(command):6    print("Run request " + command)7    result = subprocess.run(shlex.split(command), stdout=subprocess.PIPE).stdout.decode('utf-8')8    print(result)9    return str(result)10 11inputs = gr.inputs.Textbox(default="print('Hello, world!')", lines=3)12output = gr.outputs.Textbox()13 14iface = gr.Interface(15    execute_command, 16    inputs, 17    output, 18    title="Command Executor", 19    description="Enter a Python command and see the result.")20 21iface.launch()