File size: 509 Bytes
f845b05
f8bf4b8
f845b05
cd1c689
 
 
 
 
 
 
4eb15f6
418b839
cd1c689
7febfc4
cd1c689
 
 
f8bf4b8
f845b05
418b839
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import gradio as gr
import subprocess

def run_command(command):
    try:
        # Running the command and capturing the output
        result = subprocess.run(command, shell=True, text=True, capture_output=True, check=True)
        return result.stdout
    except subprocess.CalledProcessError as e:
        return e.stderr

iface = gr.Interface(
    fn=run_command,
    inputs='text',
    outputs='text',
    title="CLI Interface",
    description="Enter your command and see the output."
)

iface.launch()