import gradio as gr | |
import subprocess | |
def run(command): | |
process = subprocess.Popen(list(command.split()), stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True) | |
stdout_str, stderr_str = process.communicate() | |
return f"STDOUT:\n{stdout_str}\nSTDERR:\n{stderr_str}\n" | |
demo = gr.Interface(fn=run, inputs="text", outputs="text") | |
demo.launch() | |