Spaces:
Sleeping
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
, orBread 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
Upload a
.txt
file (max ~3MB recommended)Select a summarization style from dropdown:
Bread only
Butter only
Bread and Butter
Choose:
Iterations
: how many times the prompts applyMax Length
: max summary tokens per chunkMin Length
: min summary tokens per chunk
Click Summarize
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.