PythonTerm / app.py
quanvndzai's picture
Update app.py
52abd1a
raw
history blame contribute delete
536 Bytes
import gradio as gr
import subprocess
import shlex
def execute_command(command):
print("Run request " + command)
result = subprocess.run(shlex.split(command), stdout=subprocess.PIPE).stdout.decode('utf-8')
print(result)
return str(result)
inputs = gr.inputs.Textbox(default="print('Hello, world!')", lines=3)
output = gr.outputs.Textbox()
iface = gr.Interface(
execute_command,
inputs,
output,
title="Command Executor",
description="Enter a Python command and see the result.")
iface.launch()