File size: 712 Bytes
8c4e126
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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()