psyrishi's picture
πŸš€ Initial commit: narrative summarizer with BART model
3efb860
|
raw
history blame
4.68 kB
metadata
title: Narrative Summarizer
emoji: πŸ“š
colorFrom: indigo
colorTo: blue
sdk: gradio
sdk_version: 4.15.0
app_file: app.py
pinned: false
license: mit
tags:
  - summarization
  - text
  - transformer
  - bart
  - compression
  - gradio

πŸ“š Narrative Summarizer

Summarize long .txt narrative files into compressed, LLM-optimized summaries using BART. Choose between Bread, Butter, or both prompt styles for custom compression behavior. Upload a .txt file, select your preferences, and receive a clean, compressed summary in seconds.


πŸ“š Narrative Summarizer β€” Hugging Face Space

psyrishi/narrative-summarizer

A user-friendly summarization tool for .txt files, powered by Hugging Face Transformers and built with Gradio.

This app transforms long-form narratives into compressed, LLM-friendly summaries using either the "Bread", "Butter", or a combination of both prompt styles. It supports checkpointing to avoid data loss on interruptions and ensures large text files are processed reliably.


✨ Features

  • βœ… Supports .txt file uploads up to 3 MB (or more)
  • πŸ“Œ Prompt options: Bread, Butter, or Bread and Butter
  • πŸ” Multi-iteration summarization support
  • 🧠 Model: facebook/bart-large-cnn
  • πŸ’Ύ Auto checkpointing: progress won't be lost on timeout
  • 🧰 Output is saved for download post-processing
  • 🌐 Clean Gradio UI – easy to run in browser

πŸ“₯ How to Use

  1. Upload a .txt file (max ~3MB recommended)

  2. Select a summarization style from dropdown:

    • Bread only
    • Butter only
    • Bread and Butter
  3. Choose:

    • Iterations: how many times the prompts apply
    • Max Length: max summary tokens per chunk
    • Min Length: min summary tokens per chunk
  4. Click Summarize

  5. Get your condensed output in the results box


βš™οΈ Tech Stack

Component Details
Frontend Gradio
Backend Hugging Face transformers
Model facebook/bart-large-cnn
Checkpointing JSON-based resume system
Language Python 3.10+

πŸ“‚ Folder Structure

.
β”œβ”€β”€ app.py              # Gradio frontend app
β”œβ”€β”€ summarizer.py       # Backend summarization logic
β”œβ”€β”€ requirements.txt    # Dependencies
β”œβ”€β”€ inputs/             # Uploaded input files
β”œβ”€β”€ outputs/            # Final summarized outputs
└── checkpoints/        # Intermediate checkpointing

πŸ› οΈ Setup (Local)

Clone this repo and run it locally:

git clone https://huggingface.co/spaces/psyrishi/narrative-summarizer
cd narrative-summarizer

pip install -r requirements.txt
python app.py

πŸš€ Space Configuration

Here’s how to fill out the Hugging Face Space creation form:

Field Value
Owner psyrishi
Space Name narrative-summarizer
Short Description Summarizer for the txt files
License Choose: MIT, Apache 2.0, or Other
Space SDK βœ… Gradio
Gradio Template Start from Scratch or Blank
Hardware βœ… Free (sufficient for your use case)
Visibility Choose: Public (recommended) or Private
Dev Mode (Optional) Available to PRO subscribers

πŸ§ͺ Prompt Styles Explained

  • πŸ₯– Bread: Focuses on compression for efficient LLM parsing
  • 🧈 Butter: Enhances nuance and detail while summarizing
  • πŸ₯ͺ Bread + Butter: Applies both sequentially for balance

πŸ“Œ Example Input

Once upon a time, in a quiet village nestled between two mountains...

πŸ“€ Example Output (Bread only)

A peaceful mountain village faces hidden turmoil, gradually unveiling conflicts beneath its quiet surface.

πŸ” License

Recommend using:

MIT License

Copyright (c) 2025 psyrishi
Permission is hereby granted, free of charge, to any person obtaining a copy...

Or Apache 2.0.


πŸ‘‹ Feedback & Contributions

Feel free to fork the repo, create pull requests, or open issues if you'd like to contribute or improve the tool.