Spaces:
Sleeping
Sleeping
Download app.py from Serg4451D/linux_execute: direct link, hf CLI and curl.
- Browser
- Download file 712 Bytes
-
https://huggingface.co/spaces/Serg4451D/linux_execute/resolve/main/app.py
- Command line
-
hf download hf://spaces/Serg4451D/linux_execute/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Serg4451D/linux_execute/resolve/main/app.py
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() | |