Create app.py
Browse files
app.py
ADDED
@@ -0,0 +1,13 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
|
2 |
+
import gradio as gr
|
3 |
+
|
4 |
+
def terminal_emulator(command):
|
5 |
+
import subprocess
|
6 |
+
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
|
7 |
+
output, error = process.communicate()
|
8 |
+
if error:
|
9 |
+
return error.decode()
|
10 |
+
return output.decode()
|
11 |
+
|
12 |
+
iface = gr.Interface(fn=terminal_emulator, inputs="text", outputs="text", title="Terminal Emulator")
|
13 |
+
iface.launch(share=True,debug=True)
|