Serialtechlab commited on
Commit
9fa2093
·
verified ·
1 Parent(s): 8df7e30

Create app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -0
app.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
+ output = subprocess.run(['pwd'], stdout=subprocess.PIPE).stdout.decode('utf-8')
10
+ return f"{command}: \n {output}"
11
+ else:
12
+ output = subprocess.run(commandList, stdout=subprocess.PIPE).stdout.decode('utf-8')
13
+ return f"{command}: \n {output}"
14
+
15
+ demo = gr.Interface(fn=greet, inputs="textbox", outputs="textbox")
16
+
17
+ if __name__ == "__main__":
18
+ demo.launch()