Spaces:
Runtime error
Runtime error
Update main.py
Browse files
main.py
CHANGED
@@ -1,30 +1,21 @@
|
|
1 |
import gradio as gr
|
2 |
-
import
|
3 |
-
|
4 |
-
|
5 |
-
|
6 |
-
|
7 |
-
|
8 |
-
|
9 |
-
|
10 |
-
|
11 |
-
|
12 |
-
|
13 |
-
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
-
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
-
|
22 |
-
inputs=gr.inputs.Image(type="pil"),
|
23 |
-
outputs=gr.outputs.Label(num_top_classes=3),
|
24 |
-
)
|
25 |
-
|
26 |
-
demo.launch(server_name="0.0.0.0", server_port=7860)
|
27 |
-
|
28 |
-
|
29 |
-
if __name__ == "__main__":
|
30 |
-
run()
|
|
|
1 |
import gradio as gr
|
2 |
+
import subprocess
|
3 |
+
def run_command(command):
|
4 |
+
try:
|
5 |
+
result = subprocess.check_output(command, shell=True, text=True)
|
6 |
+
return result
|
7 |
+
except subprocess.CalledProcessError as e:
|
8 |
+
return f"Error: {e}"
|
9 |
+
iface = gr.Interface(
|
10 |
+
fn=run_command,
|
11 |
+
inputs="text",
|
12 |
+
outputs="text",
|
13 |
+
#live=True,
|
14 |
+
title="Command Output Viewer",
|
15 |
+
description="Enter a command and view its output.",
|
16 |
+
examples=[
|
17 |
+
["ls"],
|
18 |
+
["pwd"],
|
19 |
+
["echo 'Hello, Gradio!'"]]
|
20 |
+
)
|
21 |
+
iface.launch(server_name="0.0.0.0", server_port=7860)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|