Skip to content

Engineered a production-grade abstractive summarization API inspired by research on transformer-based text compression (BART, PEGASUS).

License

Notifications You must be signed in to change notification settings

Prashant-ambati/stunning-octo-barnacle

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

8 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“„ Semantic Document Summarizer

A production-grade abstractive summarization system using BART transformer model with FastAPI backend and Streamlit frontend.

Streamlit App GitHub Repository License: MIT

πŸš€ Live Demo

✨ Features

  • πŸ€– BART-large-cnn model for high-quality abstractive summarization
  • ⚑ Fast inference with optimized PyTorch implementation
  • 🌐 RESTful API with FastAPI and automatic documentation
  • 🎨 Interactive UI with Streamlit frontend
  • πŸ“Š Real-time metrics and performance analytics
  • 🐳 Docker support for easy deployment
  • ☁️ Cloud-ready with multiple deployment options

πŸ› οΈ Tech Stack

  • ML: PyTorch, HuggingFace Transformers
  • Backend: FastAPI, Pydantic
  • Frontend: Streamlit, Plotly
  • Deployment: Docker, GitHub Actions

πŸƒβ€β™‚οΈ Quick Start

🌐 Try the Live Demo

πŸ‘‰ Open Live App - No installation required!

Option 1: Local Setup (For development)

# Clone the repository
git clone https://github.com/Prashant-ambati/stunning-octo-barnacle.git
cd stunning-octo-barnacle

# Install API dependencies
pip install -r requirements_api.txt

# Start the API server
python app_simple.py

In another terminal:

# Install Streamlit dependencies
pip install -r requirements_streamlit.txt

# Start the frontend
streamlit run streamlit_app.py

Option 2: Full Production Setup

# Install all dependencies
pip install -r requirements.txt

# Start services with Docker
docker-compose up -d

# Run the full API
python -m app.main

πŸ“– API Usage

Python Example

import requests

# Summarize text
response = requests.post("http://localhost:8002/summarize", json={
    "text": "Your long document text here...",
    "max_length": 150,
    "min_length": 50
})

result = response.json()
print(f"Summary: {result['summary']}")
print(f"Compression: {result['compression_ratio']}x")

cURL Example

curl -X POST "http://localhost:8002/summarize" \
  -H "Content-Type: application/json" \
  -d '{
    "text": "Your text here...",
    "max_length": 150,
    "min_length": 50
  }'

Project Structure

β”œβ”€β”€ app/
β”‚   β”œβ”€β”€ main.py              # FastAPI application
β”‚   β”œβ”€β”€ models/              # ML model handling
β”‚   β”œβ”€β”€ api/                 # API routes
β”‚   β”œβ”€β”€ core/                # Configuration
β”‚   └── database/            # MongoDB operations
β”œβ”€β”€ models/                  # Trained model files
β”œβ”€β”€ scripts/                 # Training and evaluation
β”œβ”€β”€ tests/                   # Unit tests
β”œβ”€β”€ docker-compose.yml       # Services orchestration
β”œβ”€β”€ Dockerfile              # Container definition
└── requirements.txt        # Dependencies

Performance

  • Speed: 2.3Γ— faster inference with ONNX optimization
  • Quality: Near research-level ROUGE-L scores
  • Scalability: Handles concurrent requests with rate limiting

🌐 Deployment Options

1. Streamlit Cloud (Frontend) βœ… DEPLOYED

Live Demo

Status: βœ… LIVE at stunning-octo-barnacle-hefbzzdatffcfef5uulaju.streamlit.app

To deploy your own:

  1. Fork this repository
  2. Connect to Streamlit Cloud
  3. Deploy streamlit_app.py
  4. Update API_URL environment variable

2. Render (Full Stack)

Deploy to Render

  1. Connect your GitHub repository
  2. Use the provided render.yaml configuration
  3. Deploy both API and frontend services

3. Railway (API)

Deploy on Railway

  1. Connect your GitHub repository
  2. Railway will auto-detect the Python app
  3. Uses railway.json configuration

4. Heroku (API)

# Install Heroku CLI and login
heroku create your-app-name
git push heroku main

5. Docker Hub

# Build and push
docker build -f Dockerfile.simple -t yourusername/semantic-summarizer .
docker push yourusername/semantic-summarizer

πŸ“Š Performance

  • Model: BART-large-cnn (406M parameters)
  • Inference Speed: ~10-15 seconds per summary (CPU)
  • Compression Ratio: 2-5x typical reduction
  • Memory Usage: ~1.5GB for model loading

πŸ§ͺ Testing

# Test the model
python test_simple.py

# Test the API
python test_api.py

# Run unit tests
python -m pytest tests/ -v

πŸ“ Project Structure

β”œβ”€β”€ app/                     # Full production API
β”‚   β”œβ”€β”€ main.py             # FastAPI application
β”‚   β”œβ”€β”€ models/             # ML model handling
β”‚   β”œβ”€β”€ api/                # API routes
β”‚   └── database/           # MongoDB operations
β”œβ”€β”€ app_simple.py           # Simplified API for deployment
β”œβ”€β”€ streamlit_app.py        # Streamlit frontend
β”œβ”€β”€ test_simple.py          # Basic model test
β”œβ”€β”€ test_api.py            # API integration test
β”œβ”€β”€ requirements_api.txt    # API dependencies
β”œβ”€β”€ requirements_streamlit.txt # Frontend dependencies
β”œβ”€β”€ docker-compose.yml      # Full stack deployment
β”œβ”€β”€ Dockerfile.simple       # Simple API container
└── .github/workflows/      # CI/CD pipelines

πŸ”§ Configuration

Environment Variables

# API Configuration
API_URL=http://localhost:8002  # For Streamlit app
PORT=8002                      # API port

# Model Configuration
MODEL_NAME=facebook/bart-large-cnn
MAX_LENGTH=150
MIN_LENGTH=50

🀝 Contributing

  1. Fork the repository
  2. Create a feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

πŸ“„ License

This project is licensed under the MIT License - see the LICENSE file for details.

πŸ™ Acknowledgments

πŸ“ž Support


⭐ Star this repository if you found it helpful!

About

Engineered a production-grade abstractive summarization API inspired by research on transformer-based text compression (BART, PEGASUS).

Resources

License

Contributing

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages