Update app.py
Browse files
app.py
CHANGED
|
@@ -1,10 +1,14 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
|
|
|
| 3 |
|
| 4 |
def greet(command):
|
| 5 |
commandList = command.split(' ')
|
| 6 |
-
|
| 7 |
-
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
|
| 10 |
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
import subprocess
|
| 3 |
+
import os
|
| 4 |
|
| 5 |
def greet(command):
|
| 6 |
commandList = command.split(' ')
|
| 7 |
+
if(commandList[0] == "cd"):
|
| 8 |
+
os.chdir(commandList[1])
|
| 9 |
+
else:
|
| 10 |
+
output = subprocess.run(commandList, stdout=subprocess.PIPE).stdout.decode('utf-8')
|
| 11 |
+
return f"{command}: \n {output}"
|
| 12 |
|
| 13 |
demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
|
| 14 |
|