π HuggingFace Spaces Deployment Guide
Updated Features (v2.0.0)
Your SmolVLM2 Video Highlights app has been upgraded with:
β
HuggingFace Segment-Based Approach: More reliable than previous audio+visual system
β
SmolVLM2-256M-Video-Instruct: Optimized for Spaces resource constraints
β
Dual Criteria Generation: Two prompt variations for robust highlight selection
β
Simple Fade Transitions: Compatible effects that work across all devices
β
Fixed 5-Second Segments: Consistent AI classification without timestamp issues
Files Updated
Core System
app.py
- New FastAPI app using segment-based approachhuggingface_segment_highlights.py
- Main highlight detection logicsrc/smolvlm2_handler.py
- Updated to use 256M model by default
Configuration
README.md
- Updated documentationDockerfile
- Points to new app.py- Requirements remain the same
Deployment Steps
1. Push to HuggingFace Spaces
# If you have an existing Space, update it:
cd smolvlm2-video-highlights
git add .
git commit -m "Update to HuggingFace segment-based approach v2.0.0
- Switch to SmolVLM2-256M-Video-Instruct for better Spaces compatibility
- Implement proven segment-based classification method
- Add dual criteria generation for robust selection
- Simplify effects for universal device compatibility
- Improve API with detailed job status and progress tracking"
git push origin main
2. Update Space Settings
In your HuggingFace Space settings:
- SDK: Docker
- App Port: 7860
- Hardware: GPU T4 Small (2.2B model benefits from GPU acceleration)
- Timeout: 30 minutes (for longer videos)
3. Test the Deployment
Once deployed, your Space will be available at:
https://your-username-smolvlm2-video-highlights.hf.space
Test with the API:
# Upload video
curl -X POST \
-F "video=@test_video.mp4" \
-F "segment_length=5.0" \
-F "with_effects=true" \
https://your-space-url.hf.space/upload-video
# Check status
curl https://your-space-url.hf.space/job-status/JOB_ID
# Download results
curl -O https://your-space-url.hf.space/download/FILENAME.mp4
Key Improvements
Performance
- 40% smaller model: 256M vs 500M parameters
- Faster inference: Optimized for CPU deployment
- Lower memory: Better for Spaces hardware limits
Reliability
- No timestamp correlation: Avoids AI timing errors
- Fixed segment length: Consistent classification
- Dual prompt system: More robust criteria generation
- Simple effects: Universal device compatibility
API Features
- Real-time progress: Detailed job status updates
- Background processing: Non-blocking uploads
- Automatic cleanup: Manages disk space
- Error handling: Graceful failure modes
Monitoring
Check your Space logs for:
- Model loading success
- Processing progress
- Error messages
- Resource usage
Troubleshooting
Out of Memory
- Use CPU Basic hardware
- Consider shorter videos (<5 minutes)
- Monitor progress in Space logs
Slow Processing
- 256M model is CPU-optimized
- Processing time: ~1-2x video length
- Consider GPU upgrade for faster processing
Effects Issues
- Simple fade transitions work on all devices
- Compatible MP4 output format
- No complex filter chains
Next Steps
- Deploy and test your updated Space
- Update any client applications to use new API structure
- Monitor performance and adjust settings as needed
- Consider adding a web UI using Gradio if desired
Your upgraded system is now more reliable, efficient, and compatible with HuggingFace Spaces infrastructure!