Spaces:
Paused
Paused
File size: 536 Bytes
95ebb99 52abd1a 95ebb99 52abd1a 95ebb99 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
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() |