File size: 609 Bytes
2399f83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
import subprocess

def run_cli(command):
    try:
        result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
        return result.stdout + "\n" + result.stderr
    except Exception as e:
        return str(e)

with gr.Blocks() as infra_app:
    gr.Markdown("# Nexa Infrastructure CLI")
    command_input = gr.Textbox(label="Enter CLI Command")
    output_box = gr.Textbox(label="Output", lines=15)
    run_button = gr.Button("Run Command")
    run_button.click(fn=run_cli, inputs=command_input, outputs=output_box)

infra_app.launch()