Serg4451D commited on
Commit
8c4e126
·
verified ·
1 Parent(s): 57a6ad3

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -0
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import subprocess
3
+
4
+ def execute_command(command):
5
+ try:
6
+ # Выполняем команду и получаем вывод
7
+ result = subprocess.run(command, shell=True, capture_output=True, text=True)
8
+ return result.stdout + result.stderr # Возвращаем стандартный вывод и ошибки
9
+ except Exception as e:
10
+ return str(e)
11
+
12
+ # Создаем интерфейс Gradio
13
+ iface = gr.Interface(
14
+ fn=execute_command,
15
+ inputs="text",
16
+ outputs="text",
17
+ title="Linux Command Executor",
18
+ description="Введите команду Linux для выполнения."
19
+ )
20
+
21
+ # Запускаем интерфейс
22
+ iface.launch()