luluhacker commited on
Commit
0ddea83
·
verified ·
1 Parent(s): 584a875

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  import subprocess
3
 
4
- def run_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,11 +15,13 @@ def run_command(command):
15
  return str(e)
16
 
17
  # Create a Gradio interface
18
- iface = gr.Interface(fn=run_command,
19
- inputs="text",
20
- outputs="text",
21
- title="Linux Command Runner",
22
- description="Enter a Linux command to execute and see the output.")
 
 
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()