File size: 614 Bytes
037bc93
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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.run(command, shell=True, check=True, capture_output=True, text=True)
        return result.stdout
    except subprocess.CalledProcessError as e:
        return f"Error: {e.stderr}"

def terminal_interface(command):
    return run_command(command)

iface = gr.Interface(
    fn=terminal_interface,
    inputs=gr.Textbox(lines=2, placeholder="Enter your command here..."),
    outputs="text",
    title="Docker Command Runner",
    description="Enter Docker commands to execute in the terminal."
)

iface.launch()