File size: 699 Bytes
1a44ef2
 
15dcf8f
1a44ef2
15dcf8f
 
 
 
 
 
 
 
1a44ef2
15dcf8f
1a44ef2
15dcf8f
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import os
import subprocess
import gradio as gr

def start_gotty():
    if not os.path.exists("gotty"):
        subprocess.run(
            "curl -L https://github.com/yudai/gotty/releases/download/v1.0.1/gotty_linux_amd64.tar.gz | tar -xz",
            shell=True,
            check=True
        )
        os.chmod("gotty", 0o755)

    os.environ["TERM"] = "xterm-256color"

    subprocess.Popen([
        "./gotty",
        "-w",
        "-p", "8080",
        "-c", "pradeepydv:prdp1234",
        "bash"
    ])

start_gotty()

def ui():
    return "GoTTY running. Open the terminal at /"

demo = gr.Interface(fn=ui, inputs=[], outputs="text")

demo.launch(server_name="0.0.0.0", server_port=7860)