File size: 356 Bytes
91e441e
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
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()