Spaces:
Running
Running
File size: 4,354 Bytes
2a31b59 | 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 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 | # Pre-Session Setup Scripts
These scripts help you prepare for the HuggingFace Enabling Sessions by pre-downloading models, converting slides, and testing the Spaces app.
## Quick Start (All-in-One)
```bash
bash scripts/setup.sh
```
This runs all three scripts in sequence and prepares everything for your session.
---
## Individual Scripts
### 1οΈβ£ Download Models Locally
**Purpose:** Pre-cache all HuggingFace models on your laptop so demos run instantly
**File:** `scripts/download_models.py`
**Usage:**
```bash
python3 scripts/download_models.py
```
**What it does:**
- Downloads 5 pre-trained models (~2-3 GB total)
- Stores in `~/.cache/huggingface/hub`
- Takes 10-20 minutes depending on internet speed
- Models: Sentiment, NER, QA, Summarization, Semantic Similarity
**Why:** Models only need to download once. After this, they're cached forever.
---
### 2οΈβ£ Convert Markdown Slides to PowerPoint
**Purpose:** Convert markdown slides to editable PPTX format for your presentation
**File:** `scripts/convert_slides_to_pptx.py`
**Requirements:**
```bash
pip install python-pptx
```
**Usage:**
```bash
python3 scripts/convert_slides_to_pptx.py
```
**What it does:**
- Converts `slides/SESSION1_SLIDES.md` β `slides/SESSION1_SLIDES.pptx`
- Converts `slides/SESSION2_SLIDES.md` β `slides/SESSION2_SLIDES.pptx`
- Applies basic formatting (headers, text, colors)
**Next steps:**
- Open the PPTX files in PowerPoint or LibreOffice
- Customize colors, fonts, add speaker notes
- Add images or animations as desired
**Note:** The conversion is basic. You can enhance the PPTX afterwards in PowerPoint.
---
### 3οΈβ£ Pre-Warm Spaces App
**Purpose:** Test that the Spaces app is running and cache models on HF servers
**File:** `scripts/prewarm_spaces.py`
**Usage:**
```bash
python3 scripts/prewarm_spaces.py
```
**What it does:**
- Checks if Spaces app is online
- Waits for startup if needed (first-time builds take 2-3 min)
- Provides session readiness checklist
- Shows timing and performance info
**Expected output:**
```
β
Spaces app is online
β Sentiment Analysis cached
β NER cached
β QA cached
β Summarization cached
β Semantic Similarity cached
```
---
## Setup Timeline
| Task | Time | Notes |
|------|------|-------|
| Model Download | 10-20 min | Run once, cached forever |
| Slide Conversion | 1-2 min | One-time only |
| Spaces Pre-warm | 2-5 min | Depends on app startup |
| **Total** | **15-30 min** | Do this 30 min before session |
---
## Session Day Checklist
- [ ] Run `bash scripts/setup.sh` (30 min before session)
- [ ] Open slides in PowerPoint/LibreOffice
- [ ] Test one demo on Spaces (click "Analyze Sentiment")
- [ ] Share Spaces URL with attendees: `https://huggingface.co/spaces/Shouryahere/infy`
- [ ] Open `SPEAKER_NOTES.md` for timing reference
- [ ] Screen share test (zoom, teams, etc)
- [ ] Audio test
---
## Troubleshooting
### "ModuleNotFoundError: No module named 'python_pptx'"
```bash
pip install python-pptx
```
### Models still downloading during session?
- Run `scripts/download_models.py` earlier (it's idempotent, safe to run multiple times)
- Check internet speed: Large models (BART) can take 5+ min on slow networks
### Spaces URL not responding?
- Check: https://huggingface.co/spaces/Shouryahere/infy
- If showing "Building", wait 2-3 minutes
- If showing red error, check Spaces build logs
### Slide conversion looks poorly formatted?
- This script does basic conversion; use PowerPoint to enhance
- Recommended: Open PPTX and manually adjust formatting to match your company branding
---
## Manual Alternative
If you prefer not to run scripts:
1. **Download models:** `transformers-cli download-model distilbert-base-uncased-finetuned-sst-2-english` (repeat for each model)
2. **Convert slides:** Use CloudConvert, Zamzar, or open markdown in LibreOffice Impress
3. **Pre-warm Spaces:** Just click each button once when you're ready
---
## Advanced Options
### Custom model downloads
Edit `config.py` to change which models are downloaded
### Custom slide formatting
Edit `scripts/convert_slides_to_pptx.py` to adjust colors, fonts, sizes
### Offline demo fallback
Pre-record a video of running the demos locally in case Spaces is slow
---
π **Questions?** See SPEAKER_NOTES.md for more context.
π **Ready to present!**
|