EnterpriseActiveReader / DEMO_README.md
Vishwas1's picture
Upload 7 files
411c845 verified

A newer version of the Gradio SDK is available: 6.1.0

Upgrade

🧠 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!