Spaces:
Sleeping
Sleeping
| 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() | |