Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
@@ -10,5 +10,86 @@ pinned: false
|
|
10 |
license: mit
|
11 |
short_description: π Text & PDF Summarizer UI
|
12 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
13 |
|
14 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
10 |
license: mit
|
11 |
short_description: π Text & PDF Summarizer UI
|
12 |
---
|
13 |
+
# π Text & PDF Summarizer UI
|
14 |
+
|
15 |
+
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.
|
16 |
+
|
17 |
+
## π Key Features
|
18 |
+
|
19 |
+
- Input text manually or via PDF upload
|
20 |
+
- Extracts and summarizes PDF text using NLP
|
21 |
+
- User-friendly Gradio interface
|
22 |
+
- Uses pre-trained `facebook/bart-large-cnn` summarization model
|
23 |
+
|
24 |
+
## ποΈ Project Architecture
|
25 |
+
|
26 |
+
- **Gradio**: Frontend interface to interact with the app
|
27 |
+
- **PyPDF2**: Extracts text from PDF files
|
28 |
+
- **LangChain**: Framework for managing LLM-based workflows
|
29 |
+
- **HuggingFace**: Provides transformer models like BART for summarization
|
30 |
+
|
31 |
+
## π§ Getting Started
|
32 |
+
|
33 |
+
**1- Clone the repo**
|
34 |
+
```bash
|
35 |
+
git clone https://github.com/yourusername/text-pdf-summarizer-ui.git
|
36 |
+
cd text-pdf-summarizer-ui
|
37 |
+
```
|
38 |
+
|
39 |
+
π**Project Structure**
|
40 |
+
|
41 |
+
βββ text-pdf-summarizer-ui/
|
42 |
+
βββ app.py # Application
|
43 |
+
βββ requirements.txt
|
44 |
+
βββ README.md
|
45 |
+
|
46 |
+
**2- Create a virtual environment (optional)**
|
47 |
+
``` python -m venv venv
|
48 |
+
source venv/bin/activate # On Windows: venv\\Scripts\\activate
|
49 |
+
```
|
50 |
+
|
51 |
+
**3- Install dependencies**
|
52 |
+
|
53 |
+
```bash
|
54 |
+
pip install -r requirements.txt
|
55 |
+
```
|
56 |
+
|
57 |
+
**4- Run the app**
|
58 |
+
```bash
|
59 |
+
python app.py
|
60 |
+
```
|
61 |
+
|
62 |
+
|
63 |
+
## π§ About the Tools
|
64 |
+
|
65 |
+
**LangChain**: provides a modular framework for building applications with language models. Here, it's used to manage prompting and model output formatting.
|
66 |
+
|
67 |
+
**HuggingFace Transformers**: We use the facebook/bart-large-cnn model, a powerful encoder-decoder model ideal for summarization.
|
68 |
+
|
69 |
+
**Gradio**: lets us quickly build and share user-friendly web interfaces for Machine Learning apps.
|
70 |
+
|
71 |
+
|
72 |
+
## π Implementation Details
|
73 |
+
|
74 |
+
1- Model Initialization: Using HuggingFacePipeline via LangChain
|
75 |
+
|
76 |
+
2- PromptTemplate: Wraps text for inference
|
77 |
+
|
78 |
+
3- PDF Handling: Reads uploaded file as bytes and extracts text using PyPDF2
|
79 |
+
|
80 |
+
4- UI Logic: Built with Gradio Blocks to control layout, input, and output
|
81 |
+
|
82 |
+
|
83 |
+
## β
Example Usage
|
84 |
+
- Upload a PDF or paste article text
|
85 |
+
- Cick βConvert PDF to Textβ (if PDF)-
|
86 |
+
- Click βSummarize Textβ
|
87 |
+
- View summary below the input
|
88 |
+
|
89 |
+
## π License
|
90 |
+
MIT
|
91 |
+
|
92 |
+
## π€ Contributions
|
93 |
+
Pull requests and suggestions welcome!
|
94 |
|
95 |
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|