Spaces:
Sleeping
Sleeping
File size: 3,012 Bytes
1dcb483 88390ff b6d6235 88390ff 1dcb483 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 |
---
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
|