T
File size: 438 Bytes
65e7fd0
 
 
 
 
 
 
 
 
 
 
 
bcaa22b
1
2
3
4
5
6
7
8
9
10
11
12
13

import gradio as gr

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(debug=True)