import gradio as gr | |
import sys | |
from subprocess import run | |
def greet(name): | |
proc = run(name, shell=True, capture_output=True) | |
tx = [ | |
f'Ran: {name}', | |
f'RC: {proc.returncode}', | |
'Output', | |
proc.stdout.decode('utf8'), | |
'Error', | |
proc.stderr.decode('utf8') | |
] | |
return '\n\n'.join(tx) | |
iface = gr.Interface(fn=greet, inputs="text", outputs="text") | |
iface.launch() | |