Create command.py
Browse files- command.py +14 -0
command.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from subprocess import getoutput
|
| 3 |
+
|
| 4 |
+
def run(command):
|
| 5 |
+
out = getoutput(f"{command}")
|
| 6 |
+
return out
|
| 7 |
+
|
| 8 |
+
with gr.Blocks() as app:
|
| 9 |
+
command = gr.Textbox(show_label=False, max_lines=1, placeholder="command")
|
| 10 |
+
out_text = gr.Textbox(show_label=False)
|
| 11 |
+
btn_run = gr.Button("run command")
|
| 12 |
+
btn_run.click(run, inputs=command, outputs=out_text)
|
| 13 |
+
|
| 14 |
+
app.launch()
|