Allanatrix commited on
Commit
2399f83
·
verified ·
1 Parent(s): 33ffed8

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import subprocess
3
+
4
+ def run_cli(command):
5
+ try:
6
+ result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
7
+ return result.stdout + "\n" + result.stderr
8
+ except Exception as e:
9
+ return str(e)
10
+
11
+ with gr.Blocks() as infra_app:
12
+ gr.Markdown("# Nexa Infrastructure CLI")
13
+ command_input = gr.Textbox(label="Enter CLI Command")
14
+ output_box = gr.Textbox(label="Output", lines=15)
15
+ run_button = gr.Button("Run Command")
16
+ run_button.click(fn=run_cli, inputs=command_input, outputs=output_box)
17
+
18
+ infra_app.launch()