File size: 545 Bytes
66f8fc1
5ce139d
 
e8f2900
5ce139d
e8f2900
 
 
 
5ce139d
e8f2900
 
 
 
 
 
c7eed2a
 
 
c1f1f88
e8f2900
66f8fc1
2c4e8d2
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
import gradio as gr
import subprocess

def run_command(command):
    try:
        result = subprocess.check_output(command, shell=True, text=True)
        return result
    except subprocess.CalledProcessError as e:
        return f"Error: {e}"

iface = gr.Interface(
    fn=run_command,
    inputs="text",
    outputs="text",
    title="Command Output Viewer",
    description="Enter a command and view its output.",
    examples=[
    ["ls"],
    ["pwd"],
    ["echo 'Hello, Gradio!'"]]
)

iface.launch(server_name="0.0.0.0", server_port=7860)