Spaces:
Sleeping
Sleeping
A newer version of the Gradio SDK is available:
6.1.0
π§ Active Reading Demo - Deployment Guide
This directory contains a streamlined version of the Enterprise Active Reading Framework optimized for Hugging Face Spaces deployment.
π Files Overview
demo/
βββ app.py # Main Gradio application
βββ requirements.txt # Minimal dependencies for HF Spaces
βββ README.md # HF Space description (will appear on space page)
βββ BLOG.md # Comprehensive blog post about Active Reading
βββ SPACE_BLOG.md # Shorter, HF Space focused blog
βββ DEMO_README.md # This file - deployment instructions
π Quick Deploy to Hugging Face Spaces
Option 1: Automated Script (Recommended)
# From project root
./scripts/deploy_hf_space.sh YOUR_HF_USERNAME active-reading-demo
Option 2: Manual Deployment
# 1. Create new space at https://huggingface.co/new-space
# - Choose: Gradio SDK, Public visibility
# - Hardware: CPU Basic (free)
# 2. Copy demo files to new directory
cp -r demo/ hf-deploy/
cd hf-deploy/
# 3. Initialize git and push
git init
git add .
git commit -m "Active Reading demo"
git remote add origin https://huggingface.co/spaces/YOUR_USERNAME/SPACE_NAME
git push -u origin main
π― Demo Features
Interactive Interface
- Sample Documents: Financial, Legal, Technical, Medical examples
- Multiple Strategies: Fact extraction, summarization, Q&A generation
- Real-time Processing: Watch AI analyze documents live
- Structured Output: JSON formatted results for integration
Sample Documents Included
- π Financial Report: Quarterly earnings with growth metrics
- βοΈ Legal Contract: Software licensing agreement
- π§ Technical Manual: API documentation
- π₯ Medical Research: Clinical trial results
Active Reading Strategies
- Fact Extraction: Structured information capture
- Summarization: Concise document overviews
- Question Generation: Comprehension assessment
- Complete Analysis: All strategies combined
π§ Technical Details
Model Configuration
- Model:
microsoft/DialoGPT-small(optimized for HF Spaces) - Device: Auto-detection (CPU/GPU)
- Memory: Optimized for free tier limits
- Processing: Real-time with progress indicators
Dependencies
torch>=2.0.0
transformers>=4.30.0
gradio>=4.0.0
numpy>=1.24.0
Hardware Requirements
- Minimum: CPU Basic (FREE on HF Spaces)
- Recommended: CPU Upgrade ($0.05/hour)
- Optimal: GPU T4 ($0.60/hour) for faster processing
π Performance Expectations
Processing Speed
- CPU Basic: 10-30 seconds per document
- CPU Upgrade: 5-15 seconds per document
- GPU T4: 2-5 seconds per document
Document Limits
- Text Length: Up to 2000 words (demo limitation)
- Concurrent Users: 10-50 depending on hardware
- Response Time: 95th percentile under 30 seconds
π¨ Customization Options
Branding
Update in app.py:
# Change title and description
gr.Blocks(title="Your Company Active Reading", theme=gr.themes.Soft())
# Update header
gr.Markdown("# π§ Your Company Active Reading Demo")
Sample Documents
Add your own samples in app.py:
sample_texts = {
"Your Document Type": """
Your sample content here...
""",
# ... existing samples
}
Strategies
Extend reading strategies:
# In SimpleActiveReader class
def custom_strategy(self, text: str) -> List[str]:
# Your custom processing logic
return results
π Analytics and Monitoring
Built-in Metrics
- Document processing counts
- Strategy usage patterns
- Error rates and performance
- User interaction patterns
HF Spaces Analytics
- View usage stats in HF Spaces dashboard
- Monitor resource consumption
- Track user engagement
π Security Considerations
Demo Limitations
- No data persistence: Sessions are temporary
- No user authentication: Public access
- Limited PII protection: Basic patterns only
- No audit logging: Demo purposes only
For Production Use
Upgrade to full enterprise framework for:
- User authentication and authorization
- Comprehensive PII detection
- Audit logging and compliance
- Data encryption and persistence
π Troubleshooting
Common Issues
Model Loading Errors:
# Check if model downloads properly
python -c "from transformers import AutoTokenizer; AutoTokenizer.from_pretrained('microsoft/DialoGPT-small')"
Memory Issues:
- Reduce max_length in model config
- Use smaller batch sizes
- Upgrade to paid HF Spaces hardware
Slow Performance:
- Upgrade to GPU hardware
- Optimize chunk sizes
- Cache model loading
Error Messages
- "Model not loaded": Model initialization failed
- "Processing timeout": Document too large or complex
- "Memory error": Upgrade hardware or reduce input size
π Documentation Links
Active Reading Research
Enterprise Framework
Hugging Face Resources
π€ Contributing
Improve the Demo
- Add new sample documents
- Implement additional reading strategies
- Enhance UI/UX design
- Optimize performance
Extend Functionality
- Multi-language support
- Advanced visualization
- Integration examples
- Mobile responsiveness
π Support
For Demo Issues
- Check HF Spaces logs
- Review error messages
- Test locally first
- Update dependencies
For Enterprise Deployment
- Review full framework documentation
- Contact for pilot programs
- Custom implementation support
- Training and consultation
π Success Metrics
Demo Engagement
- Time spent on demo
- Documents analyzed
- Strategies tested
- Return visitors
Enterprise Interest
- Contact form submissions
- GitHub stars and forks
- Enterprise inquiries
- Pilot program requests
Ready to deploy? Use the automated script or follow manual steps above!
./scripts/deploy_hf_space.sh YOUR_USERNAME active-reading-demo
π Your Active Reading demo will be live in minutes!