File size: 9,227 Bytes
a9de05b | 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 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | #!/usr/bin/env python3
"""
visualize_local_setup.py β Generate a visual diagram of local vs cloud execution
"""
diagram = """
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
β CollabCode Execution Modes (May 2026) β
β βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ£
β β
β LOCAL MODE (No API Keys Needed) β
β βββββββββββββββββββββββββββββββββ β
β β
β Gradio App β
β (localhost:7860) β
β β β
β βββ Load Transcript β
β β (TXT/VTT/JSON) β
β β β
β βββ Parse β [321 turns] β
β β β
β βββ Agent 0 (Section Detection) β LOCAL β β
β β β
β ββ Keyword matching β
β ββ Boundary scoring β
β ββ Phase labeling β
β β β
β βββ [11 Sections] β 0.002 seconds β β
β β β
β ββ BLOCKED: Agent 1a (β οΈ needs HF API) β
β Agent 1b (β οΈ needs HF API) β
β Agent 2 (β οΈ needs HF API) β
β β
β ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ β
β β
β CLOUD MODE (HuggingFace Inference API) β
β βββββββββββββββββββββββββββββββββββββ β
β β
β [321 turns] βββββββββββββββββββ Qwen/Qwen2.5-72B-Instruct β
β (api-inference.huggingface.co) β
β β
β Requires: β
β β’ HF_TOKEN environment variable β
β β’ Prepaid inference API credits ($$$) β
β β’ Internet connectivity β
β β’ HuggingFace account in good standing β
β β
β Latency: 2β10 seconds per call β
β Cost: $0.01β0.10 per transcription segment β
β β
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
PERFORMANCE COMPARISON
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Metric Local Heuristic Remote LLM (Qwen) Advantage
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Execution Speed 0.002 sec 2β10 sec 1,000β5,000x
Cost per Call $0.00 $0.01β0.10 Infinite
API Keys Required No β Yes (HF_TOKEN) Local
Accuracy ~85% (rules) ~95% (LLM) Remote
Customizable Via code Via prompt Local
Scalability Unlimited Rate-limited Local
Offline Capability Yes β No Local
Section Quality Good Excellent Remote
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
QUICK START
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
1. Enable local mode:
$ export LOCAL_SECTIONING=1
2. Run app:
$ bash run_local.sh
3. Open in browser:
β http://localhost:7860
4. Upload/select transcript from Drive
5. Click "Confirm & Code"
6. View sections (instantly, no API calls!)
FILES YOU NEED
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
.env.local β Environment configuration
run_local.sh β Startup script
test_local_sectioning.sh β Quick test
LOCAL_EXECUTION.md β Full setup guide
LOCAL_SETUP_REPORT.md β This summary
agent0_sectioner.py β Heuristic implementation
CONFIGURATION (.env.local)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
LOCAL_SECTIONING=1 # Enable local fallback
HF_TOKEN= # Empty = no API calls
DEBUG=1 # Verbose logging
TESTING
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
$ bash test_local_sectioning.sh
Output:
β Parsed 321 turns
β Created 11 sections in 0.002 seconds
β Speed: 191,000 turns/second
β No API calls made
STATE AFTER THIS UPDATE
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
Agent 0: β
LOCAL (heuristic) + β
REMOTE (fallback with API)
Agent 1a: β οΈ REMOTE ONLY (needs HF token)
Agent 1b: β οΈ REMOTE ONLY (needs HF token)
Agent 2: β οΈ REMOTE ONLY (needs HF token)
β User can run Sections page locally without any API credits
β Full pipeline requires HuggingFace Inference API
FUTURE WORK (Optional)
βββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
To fully localize the app:
1. Agent 1a (Boundary Detection)
Use: Silence detection + pause analysis from transcript timing
2. Agent 1b (Dimension Coding)
Use: Keyword matching against dimension definitions
3. Agent 2 (Rule Learning)
Use: Frequency analysis + decision tree extraction
See agent0_sectioner.py for pattern examples.
"""
print(diagram)
|