File size: 2,781 Bytes
85f900d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
61
62
63
64
65
66
67
68
69
70
"""
ui.tabs.settings_tab
====================
Tab 4 β€” Settings

All configurable runtime parameters:
  - ASR model selection (Large-v3 GPU vs Distil-Large CPU)
  - Voice output: toggle, rate, pitch, voice selector
  - Retrieval: k, BM25 vs vector weight, re-ranker on/off
  - LLM: Groq vs Gemini toggle, max answer length, citation density
  - Chunking: chunk size, overlap (advanced)

Status: PLACEHOLDER β€” full implementation in Phase 5.
"""

from __future__ import annotations

import gradio as gr


def build_settings_tab() -> None:
    """
    Build and render the Settings tab.
    Called by app.py within a gr.Tab("Settings") block.
    """
    gr.Markdown(
        """
        ## βš™οΈ Settings
        *Configure ASR, retrieval, generation, and voice output parameters.*

        ---
        **Coming in Phase 5 (partially Phase 3 & 4):**
        - 🎀 ASR: Whisper Large-v3 (GPU) vs Distil-Whisper (CPU)
        - πŸ”Š Voice: toggle, speaking rate, pitch, browser voice selector
        - πŸ” Retrieval: number of results (k), re-ranker on/off
        - 🧠 LLM: Groq vs Gemini, max tokens, citation density
        - 🧩 Chunking: target size, overlap (advanced)
        """
    )

    with gr.Accordion("🎀 ASR Settings", open=True):
        gr.Radio(
            label="Whisper Model",
            choices=["Large-v3 (GPU, best quality)", "Distil-Large-v3 (CPU, fast)"],
            value="Large-v3 (GPU, best quality)",
            interactive=False,
        )

    with gr.Accordion("πŸ”Š Voice Output", open=True):
        gr.Checkbox(label="Enable Voice Output", value=True, interactive=False)
        gr.Slider(label="Speaking Rate", minimum=0.5, maximum=2.0, value=1.0, step=0.1, interactive=False)
        gr.Slider(label="Pitch", minimum=0.5, maximum=2.0, value=1.0, step=0.1, interactive=False)

    with gr.Accordion("πŸ” Retrieval Settings", open=False):
        gr.Slider(label="Number of Final Chunks (k)", minimum=1, maximum=10, value=5, step=1, interactive=False)
        gr.Checkbox(label="Cross-Encoder Re-ranking", value=True, interactive=False)

    with gr.Accordion("🧠 LLM Settings", open=False):
        gr.Radio(
            label="Primary LLM",
            choices=["Groq Llama-3.1-70B (fast)", "Gemini 1.5 Flash (fallback)"],
            value="Groq Llama-3.1-70B (fast)",
            interactive=False,
        )
        gr.Slider(label="Max Answer Tokens", minimum=100, maximum=800, value=500, step=50, interactive=False)

    with gr.Accordion("🧩 Chunking Settings (Advanced)", open=False):
        gr.Slider(label="Target Chunk Size (tokens)", minimum=200, maximum=800, value=500, step=50, interactive=False)
        gr.Slider(label="Chunk Overlap (tokens)", minimum=0, maximum=100, value=50, step=10, interactive=False)