File size: 547 Bytes
4464055
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
#!/usr/bin/python3
# -*- coding: utf-8 -*-
import gradio as gr

from toolbox.os.command import Command


def shell(cmd: str):
    return Command.popen(cmd)


def get_shell_tab():
    with gr.TabItem("shell"):
        shell_text = gr.Textbox(label="cmd")
        shell_button = gr.Button("run")
        shell_output = gr.Textbox(label="output", max_lines=100)

        shell_button.click(
            shell,
            inputs=[shell_text, ],
            outputs=[shell_output],
        )

    return locals()


if __name__ == "__main__":
    pass