Spaces:
Sleeping
Sleeping
title: Text Pdf Summarizer Ui | |
emoji: π | |
colorFrom: blue | |
colorTo: gray | |
sdk: gradio | |
sdk_version: 5.29.0 | |
app_file: app.py | |
pinned: false | |
license: mit | |
short_description: π Text & PDF Summarizer UI | |
# π Text & PDF Summarizer UI | |
A lightweight web application that allows users to paste text or upload a PDF document, then summarizes the content using a HuggingFace transformer model integrated with LangChain and displayed via a Gradio interface. | |
## π Key Features | |
- Input text manually or via PDF upload | |
- Extracts and summarizes PDF text using NLP | |
- User-friendly Gradio interface | |
- Uses pre-trained `facebook/bart-large-cnn` summarization model | |
## ποΈ Project Architecture | |
- **Gradio**: Frontend interface to interact with the app | |
- **PyPDF2**: Extracts text from PDF files | |
- **LangChain**: Framework for managing LLM-based workflows | |
- **HuggingFace**: Provides transformer models like BART for summarization | |
## π§ Getting Started | |
**1- Clone the repo** | |
```bash | |
git clone https://github.com/rahimizadeh/text-pdf-summarizer-ui.git | |
cd text-pdf-summarizer-ui | |
``` | |
π**Project Structure** | |
βββ text-pdf-summarizer-ui/ | |
βββ app.py # Application | |
βββ requirements.txt | |
βββ README.md | |
**2- Create a virtual environment (optional)** | |
``` python -m venv venv | |
source venv/bin/activate # On Windows: venv\\Scripts\\activate | |
``` | |
**3- Install dependencies** | |
```bash | |
pip install -r requirements.txt | |
``` | |
**4- Run the app** | |
```bash | |
python app.py | |
``` | |
## π§ About the Tools | |
**LangChain**: provides a modular framework for building applications with language models. Here, it's used to manage prompting and model output formatting. | |
**HuggingFace Transformers**: We use the facebook/bart-large-cnn model, a powerful encoder-decoder model ideal for summarization. | |
**Gradio**: lets us quickly build and share user-friendly web interfaces for Machine Learning apps. | |
## π Implementation Details | |
1- Model Initialization: Using HuggingFacePipeline via LangChain | |
2- PromptTemplate: Wraps text for inference | |
3- PDF Handling: Reads uploaded file as bytes and extracts text using PyPDF2 | |
4- UI Logic: Built with Gradio Blocks to control layout, input, and output | |
## β Example Usage | |
- Upload a PDF or paste article text | |
- Cick βConvert PDF to Textβ (if PDF)- | |
- Click βSummarize Textβ | |
- View summary below the input | |
## π License | |
MIT | |
## π€ Contributions | |
Pull requests and suggestions welcome! | |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference | |