File size: 656 Bytes
6eed7cc
 
 
00ced88
6eed7cc
 
 
 
 
 
 
 
 
 
 
 
 
 
9778b3f
6eed7cc
 
 
 
00ced88
6eed7cc
 
 
00ced88
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
import gradio as gr
import subprocess

logs = []  # ู„ุชุฎุฒูŠู† ุงู„ู„ูˆุฌุงุช

def run_training():
    global logs
    logs = []
    process = subprocess.Popen(
        ["python", "run.py"],
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
        text=True,
        bufsize=1
    )

    for line in process.stdout:
        logs.append(line)
        yield "\n".join(logs[:])

with gr.Blocks() as demo:
    with gr.Row():
        btn = gr.Button("๐Ÿš€ Start Training")
    output = gr.Textbox(label="Logs", lines=25, interactive=False)

    btn.click(fn=run_training, outputs=output)

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