| import gradio as gr | |
| import subprocess | |
| def run(command): | |
| result = subprocess.run(command, shell=True, capture_output=True, text=True) | |
| return f"STDOUT:\n{result.stdout}\nSTDERR:\n{result.stderr}\n" | |
| demo = gr.Interface(fn=run, inputs="text", outputs="text") | |
| demo.launch(share=True) | |