File size: 1,626 Bytes
f538642
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# app.py

import gradio as gr
import subprocess
import os
import time

def run_pipeline():
    """
    Runs the pipeline.sh script and yields its output line by line.
    """
    # Make sure the script is executable
    os.chmod("pipeline.sh", 0o755)
    
    # Start the subprocess
    process = subprocess.Popen(
        ["./pipeline.sh"],
        stdout=subprocess.PIPE,
        stderr=subprocess.STDOUT,
        text=True,
        bufsize=1,
        universal_newlines=True,
    )

    # Yield each line of output from the script
    yield "--- Pipeline Started ---\n"
    for line in process.stdout:
        yield line
        time.sleep(0.05) # Small sleep to make streaming smooth
    
    process.wait()
    yield f"\n--- Pipeline Finished with exit code: {process.returncode} ---"


with gr.Blocks() as demo:
    gr.Markdown("# 🚀 Bengali-Code LLM - Dev Pipeline Demonstrator")
    gr.Markdown(
        "This Space demonstrates the end-to-end development pipeline for the Bengali-Code LLM. "
        "It runs in **Dev Mode** on a free CPU, using sample data and training a tiny ~1M parameter model. "
        "Click the button below to start the run and see the live logs."
    )
    
    start_button = gr.Button("▶️ Start Pipeline Run", variant="primary")
    
    console_output = gr.Textbox(
        label="Live Console Output",
        lines=25,
        max_lines=25,
        interactive=False,
        autoscroll=True,
        placeholder="Pipeline output will appear here..."
    )

    start_button.click(
        fn=run_pipeline,
        inputs=[],
        outputs=[console_output]
    )

demo.launch()