linux_execute / app.py
Serg4451D's picture
Create app.py
8c4e126 verified
raw
history blame contribute delete
712 Bytes
import gradio as gr
import subprocess
def execute_command(command):
try:
# Выполняем команду и получаем вывод
result = subprocess.run(command, shell=True, capture_output=True, text=True)
return result.stdout + result.stderr # Возвращаем стандартный вывод и ошибки
except Exception as e:
return str(e)
# Создаем интерфейс Gradio
iface = gr.Interface(
fn=execute_command,
inputs="text",
outputs="text",
title="Linux Command Executor",
description="Введите команду Linux для выполнения."
)
# Запускаем интерфейс
iface.launch()