File size: 466 Bytes
65e7fd0 ab55d09 65e7fd0 d23856c 65e7fd0 25bc96a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
import gradio as gr
import spaces
@spaces.GPU
def terminal_emulator(command):
import subprocess
process = subprocess.Popen(command, shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE, stdin=subprocess.PIPE)
output, error = process.communicate()
if error:
return error.decode()
return output.decode()
iface = gr.Interface(fn=terminal_emulator, inputs="text", outputs="text", title="Terminal Emulator")
iface.launch(share=True)
|