Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,7 +1,7 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
| 3 |
|
| 4 |
-
def
|
| 5 |
try:
|
| 6 |
# Run the command and capture the output
|
| 7 |
result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
|
@@ -15,11 +15,13 @@ def run_command(command):
|
|
| 15 |
return str(e)
|
| 16 |
|
| 17 |
# Create a Gradio interface
|
| 18 |
-
iface = gr.Interface(
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
|
|
|
|
|
|
| 23 |
|
| 24 |
# Launch the interface
|
| 25 |
iface.launch()
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
| 3 |
|
| 4 |
+
def execute_command(command):
|
| 5 |
try:
|
| 6 |
# Run the command and capture the output
|
| 7 |
result = subprocess.run(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True)
|
|
|
|
| 15 |
return str(e)
|
| 16 |
|
| 17 |
# Create a Gradio interface
|
| 18 |
+
iface = gr.Interface(
|
| 19 |
+
fn=execute_command,
|
| 20 |
+
inputs=gr.inputs.Textbox(lines=2, placeholder="Enter your command here...", label="Command"),
|
| 21 |
+
outputs="text",
|
| 22 |
+
title="Command Prompt Interface",
|
| 23 |
+
description="A simple web-based command prompt where you can run Linux commands."
|
| 24 |
+
)
|
| 25 |
|
| 26 |
# Launch the interface
|
| 27 |
iface.launch()
|