File size: 418 Bytes
41a5364 5f07c84 19538fb 41a5364 5f07c84 19538fb 41a5364 19538fb |
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 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()
|