Download visualize_local_setup.py from pylxi/script: direct link, hf CLI and curl.
- Browser
- Download file 9.23 kB
-
https://huggingface.co/spaces/pylxi/script/resolve/main/visualize_local_setup.py
- Command line
-
hf download hf://spaces/pylxi/script/visualize_local_setup.py
-
curl -L -o visualize_local_setup.py https://huggingface.co/spaces/pylxi/script/resolve/main/visualize_local_setup.py
9.23 kB
| #!/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) | |