A newer version of the Gradio SDK is available: 6.20.0
title: Conversation Summary Generator
emoji: 📝
colorFrom: blue
colorTo: green
sdk: gradio
sdk_version: 6.14.0
python_version: '3.10'
app_file: app.py
pinned: false
Dialogue Summarizer
An interactive Gradio app that summarizes chat-style conversations using a fine-tuned google/flan-t5-small model from Hugging Face.
The model was fine-tuned on the SAMSum dialogue summarization dataset. Users can paste a conversation, click submit, and receive a short generated summary.
Demo
Tom: Did you submit the report?
Anika: Not yet, I'm fixing the charts.
Tom: The deadline is 5 pm.
Anika: I know. I'll send it by 4:30.
Tom: Great, please copy me on the email.
Expected output:
Anika is fixing the report charts and will send the report by 4:30, copying Tom.
Features
- Fine-tuned T5/FLAN-T5 sequence-to-sequence summarization model
- Simple Gradio web interface
- Built-in example conversations
- Beam search generation for better summaries
- Local model loading from the
conversation_summarizer/folder
Project Structure
conversation_summarizer/
+-- app.py
+-- model.py
+-- requirements.txt
+-- README.md
+-- conversation_summarizer/
+-- config.json
+-- generation_config.json
+-- model.safetensors
+-- spiece.model
+-- tokenizer_config.json
+-- special_tokens_map.json
Setup
Create and activate a virtual environment:
python -m venv env
Windows:
env\Scripts\activate
macOS/Linux:
source env/bin/activate
Install dependencies:
pip install -r requirements.txt
Run The App
python app.py
Gradio will start a local app and print a URL like:
http://127.0.0.1:7860
Open the URL in your browser and try one of the example conversations.
Example Inputs
Nora: Are you picking up the groceries today?
Eli: Yes, after work.
Nora: Please get milk, eggs, and bread.
Eli: Got it. Anything else?
Nora: Bananas if they look fresh.
Eli: Okay, I'll be home around 6:30.
Priya: Did you call the dentist?
Karan: Yes, they had an opening tomorrow at 11.
Priya: Great. Did you book it?
Karan: Yes, I confirmed it.
Priya: Thanks. I'll leave work early to go.
Sam: The Wi-Fi is down again.
Lina: I restarted the router, but it didn't help.
Sam: Should I call the provider?
Lina: Yes, please. Tell them it stopped working an hour ago.
Sam: Okay, I'll call them now.
Training
The training script is in model.py.
It:
- Loads the SAMSum dataset.
- Loads
google/flan-t5-small. - Tokenizes dialogues as inputs and summaries as labels.
- Fine-tunes the model with
Seq2SeqTrainer. - Evaluates with ROUGE.
- Saves the trained model and tokenizer.
Run training with:
python model.py
Note: training is much faster with a CUDA-enabled GPU.
Model Notes
The app expects a saved Hugging Face model folder at:
./conversation_summarizer
This folder should contain files like:
model.safetensors
config.json
spiece.model
tokenizer_config.json
generation_config.json
If you retrain the model and save it to another folder, update this line in app.py:
model = T5ForConditionalGeneration.from_pretrained("./conversation_summarizer")
tokenizer = T5Tokenizer.from_pretrained("./conversation_summarizer")
Evaluation
The model is evaluated using ROUGE:
rouge1: unigram overlaprouge2: bigram overlaprougeL: longest common subsequence overlaprougeLsum: summarization-oriented ROUGE-L
ROUGE scores usually range from 0 to 1, where higher is better.
Before Pushing To GitHub
Do not commit the local virtual environment:
env/
If the model file is large, consider using Git LFS or uploading the model to the Hugging Face Hub instead of committing model.safetensors directly.
Recommended .gitignore:
env/
__pycache__/
*.pyc
.ipynb_checkpoints/
results/
logs/
Git Commands
Initialize the repo:
git init
git add app.py model.py requirements.txt README.md conversation_summarizer/
git commit -m "Add dialogue summarizer app"
Connect to GitHub:
git branch -M main
git remote add origin https://github.com/YOUR_USERNAME/YOUR_REPO_NAME.git
git push -u origin main
Tech Stack
- Python
- Hugging Face Transformers
- Hugging Face Datasets
- Evaluate
- ROUGE
- Gradio
- FLAN-T5
Limitations
This is a small fine-tuned model, so it may occasionally miss details or infer something incorrectly. It works best when the dialogue clearly identifies speakers, actions, and decisions.