Skip to content

imHardik1606/T5-Text-Summarizer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Text Summarizer App

A simple web application built with FastAPI and Hugging Face Transformers that uses the T5 model to generate concise summaries from dialogue or long text.

Features

  • Data Training Pipeline: Includes a Jupyter Notebook for data preprocessing and model training.
  • T5-based Summarization: Uses a fine-tuned T5 model for high-quality text compression.
  • FastAPI Backend: High-performance asynchronous API.
  • Jinja2 Templates: Simple HTML interface for easy interaction.
  • Hardware Acceleration: Automatically detects and uses CUDA (NVIDIA) or MPS (Apple Silicon) if available, falling back to CPU.

Workflow

graph TD
    A[CSV Data] --> B[Notebook: Preprocessing]
    B --> C[Notebook: Model Training]
    C --> D[Saved Model Artifacts]
    D --> E[FastAPI /summarize Endpoint]
    E --> F[Data Cleaning / Regex]
    F --> G[T5 Tokenization]
    G --> H[Model Inference]
    H --> I[Return Summary JSON]
Loading

Project Structure

.
├── app.py                  # FastAPI application logic
├── index.html              # Frontend UI
├── text_summarizer.ipynb   # Data preprocessing & training pipeline
├── data/                   # Source .csv datasets for training
├── saved_summary_model/    # Local T5 model weights and tokenizer (output of notebook)
└── venv/                   # Python virtual environment

Setup & Installation

  1. Clone the repository:

    git clone github.com/imHardik1606/T5-Text-Summarizer
    cd "Summarizer App"
  2. Create and activate a virtual environment:

    python -m venv venv
    .\venv\Scripts\Activate.ps1
  3. Install dependencies:

    pip install fastapi uvicorn transformers torch jinja2 sentencepiece
  4. Add your model: Place your fine-tuned T5 model files inside the saved_summary_model/ folder.

Running the App

Start the server using uvicorn:

uvicorn app:app --reload

Open your browser and navigate to http://127.0.0.1:8000.

API Endpoints

  • GET /: Serves the web-based UI.
  • POST /summarize: Accepts a JSON body {"dialogue": "your text here"} and returns a summary.

License

MIT

About

A FastAPI-powered web application using Hugging Face's T5 Transformer model to generate concise text summaries. Features auto-device detection (CUDA/MPS/CPU) and a clean HTML interface.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors