MegaTronX commited on
Commit
e082c48
Β·
verified Β·
1 Parent(s): 16b3c97

Create app.py

Browse files

![d40a4b12-dc19-4b20-9882-c3b163d39aef.jpg](https://cdn-uploads.huggingface.co/production/uploads/66b40f9817f9cb4e8d654050/x67E_r0RDfq-8X5W9aAhq.jpeg)

Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import subprocess
3
+
4
+ def run_command(command):
5
+ try:
6
+ result = subprocess.run(command, shell=True, check=True, capture_output=True, text=True)
7
+ return result.stdout
8
+ except subprocess.CalledProcessError as e:
9
+ return f"Error: {e.stderr}"
10
+
11
+ def terminal_interface(command):
12
+ return run_command(command)
13
+
14
+ iface = gr.Interface(
15
+ fn=terminal_interface,
16
+ inputs=gr.Textbox(lines=2, placeholder="Enter your command here..."),
17
+ outputs="text",
18
+ title="Command Runner",
19
+ description="Enter Docker commands to execute in the terminal."
20
+ )
21
+
22
+ iface.launch()