Allanatrix's picture
Create app.py
2399f83 verified
raw
history blame contribute delete
609 Bytes
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()