Spaces:
Running
Running
Update README.md
Browse files
README.md
CHANGED
@@ -1,87 +1,133 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
# β
SmartManuals-AI for Hugging Face Spaces
|
2 |
|
3 |
-
SmartManuals-AI is a local-first document QA system that uses
|
|
|
|
|
4 |
|
5 |
---
|
6 |
|
7 |
## π§ Features
|
8 |
|
9 |
-
-
|
10 |
-
- π
|
11 |
-
-
|
12 |
-
- ποΈ
|
13 |
-
- π¬
|
14 |
-
-
|
15 |
|
16 |
---
|
17 |
|
18 |
## π Folder Structure
|
|
|
19 |
```
|
20 |
SmartManuals-AI/
|
21 |
-
βββ app.py # Hugging Face
|
22 |
-
βββ Manuals/ #
|
23 |
β βββ OM_Treadmill.pdf
|
24 |
β βββ Parts_Bike.docx
|
25 |
-
βββ chroma_store/ #
|
26 |
-
βββ requirements.txt #
|
27 |
-
βββ README.md #
|
28 |
```
|
29 |
|
30 |
---
|
31 |
|
32 |
-
## π Usage
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
-
|
35 |
-
|
36 |
|
37 |
-
|
38 |
|
39 |
-
###
|
40 |
-
Put all your manuals (PDF and Word `.docx`) into the `Manuals/` folder.
|
41 |
|
42 |
-
|
43 |
-
-
|
44 |
-
-
|
45 |
-
-
|
46 |
-
- Chunks and embeds content into ChromaDB
|
47 |
-
- During inference:
|
48 |
-
- Retrieves semantically relevant chunks
|
49 |
-
- Sends them to LLaMA 3.1 Instruct for answer generation
|
50 |
|
51 |
-
|
52 |
-
|
|
|
|
|
53 |
|
54 |
---
|
55 |
|
56 |
-
##
|
57 |
-
|
58 |
-
-
|
59 |
-
-
|
|
|
60 |
|
61 |
---
|
62 |
|
63 |
## π§© Supported File Types
|
64 |
-
|
65 |
-
- `.
|
|
|
66 |
|
67 |
---
|
68 |
|
69 |
## π§ͺ Local Development
|
70 |
-
|
|
|
|
|
71 |
```bash
|
|
|
|
|
72 |
pip install -r requirements.txt
|
73 |
-
```
|
74 |
-
Run locally:
|
75 |
-
```bash
|
76 |
python app.py
|
77 |
```
|
78 |
|
|
|
|
|
79 |
---
|
80 |
|
81 |
-
## π¨π½βπ»
|
82 |
-
|
|
|
|
|
|
|
83 |
|
84 |
---
|
85 |
|
86 |
-
##
|
87 |
-
|
|
|
|
1 |
+
---
|
2 |
+
title: SmartManuals-AI
|
3 |
+
emoji: π§
|
4 |
+
colorFrom: indigo
|
5 |
+
colorTo: red
|
6 |
+
sdk: gradio
|
7 |
+
sdk_version: 4.29.0
|
8 |
+
app_file: app.py
|
9 |
+
pinned: false
|
10 |
+
license: apache-2.0
|
11 |
+
tags:
|
12 |
+
- RAG
|
13 |
+
- LLM
|
14 |
+
- Chroma
|
15 |
+
- Gradio
|
16 |
+
- OCR
|
17 |
+
- HuggingFace
|
18 |
+
- PDF
|
19 |
+
- Word
|
20 |
+
- SemanticSearch
|
21 |
+
- SmartManualsAI
|
22 |
+
---
|
23 |
+
|
24 |
# β
SmartManuals-AI for Hugging Face Spaces
|
25 |
|
26 |
+
SmartManuals-AI is a local-first document QA system that uses **retrieval-augmented generation (RAG)**, **OCR**, and **semantic embeddings** to answer technical questions from equipment manuals, service guides, and parts catalogs.
|
27 |
+
|
28 |
+
This app is optimized for Hugging Face Spaces and **requires no user upload** β just preload your manuals in a `Manuals/` folder.
|
29 |
|
30 |
---
|
31 |
|
32 |
## π§ Features
|
33 |
|
34 |
+
- π§ Ask **natural-language questions** against your own manuals
|
35 |
+
- π Supports both **PDF** and **Word (.docx)** documents
|
36 |
+
- π Uses `sentence-transformers` for semantic search
|
37 |
+
- ποΈ Indexes chunks in **ChromaDB** (stored locally)
|
38 |
+
- π¬ Generates answers via Hugging Face models (default: **Meta LLaMA 3.1 8B Instruct**)
|
39 |
+
- π₯οΈ Clean **Gradio interface** for querying
|
40 |
|
41 |
---
|
42 |
|
43 |
## π Folder Structure
|
44 |
+
|
45 |
```
|
46 |
SmartManuals-AI/
|
47 |
+
βββ app.py # Main Hugging Face app
|
48 |
+
βββ Manuals/ # Place your PDF and DOCX manuals here
|
49 |
β βββ OM_Treadmill.pdf
|
50 |
β βββ Parts_Bike.docx
|
51 |
+
βββ chroma_store/ # Vector database (auto-generated)
|
52 |
+
βββ requirements.txt # Dependencies
|
53 |
+
βββ README.md # This file
|
54 |
```
|
55 |
|
56 |
---
|
57 |
|
58 |
+
## π Usage on Hugging Face Spaces
|
59 |
+
|
60 |
+
### π Environment Variable
|
61 |
+
|
62 |
+
Add this secret in your Space settings:
|
63 |
+
|
64 |
+
| Name | Value |
|
65 |
+
|-----------|----------------------|
|
66 |
+
| `HF_TOKEN` | Your Hugging Face token |
|
67 |
+
|
68 |
+
> **Note**: You must accept model licenses on [Hugging Face Hub](https://huggingface.co/meta-llama) before using gated models like `Llama-3.1-8B-Instruct`.
|
69 |
+
|
70 |
+
---
|
71 |
+
|
72 |
+
### π€ Uploading Manuals
|
73 |
|
74 |
+
- Upload your **PDF and Word documents** directly to the `Manuals/` folder in your Space repository.
|
75 |
+
- No need for file uploads via the interface.
|
76 |
|
77 |
+
---
|
78 |
|
79 |
+
### π§ How It Works
|
|
|
80 |
|
81 |
+
- On app startup:
|
82 |
+
- Text is extracted from **PDFs (with OCR fallback)** and `.docx` Word files
|
83 |
+
- Sentences are cleaned, chunked, and embedded with `all-MiniLM-L6-v2`
|
84 |
+
- Chunks are stored in a local **ChromaDB vector database**
|
|
|
|
|
|
|
|
|
85 |
|
86 |
+
- At query time:
|
87 |
+
- Your question is embedded and semantically compared against chunks
|
88 |
+
- The most relevant chunks are passed to the LLM
|
89 |
+
- The **LLM (LLaMA 3.1)** generates a focused answer from context only
|
90 |
|
91 |
---
|
92 |
|
93 |
+
## π€ Default Model
|
94 |
+
|
95 |
+
- This app uses: **`meta-llama/Llama-3.1-8B-Instruct`**
|
96 |
+
- More models are supported behind-the-scenes (e.g. Mistral, Gemma)
|
97 |
+
- **No need to manually pick** models, doc types, or categories
|
98 |
|
99 |
---
|
100 |
|
101 |
## π§© Supported File Types
|
102 |
+
|
103 |
+
- β
PDF (`.pdf`) with OCR fallback using Tesseract
|
104 |
+
- β
Word Documents (`.docx`)
|
105 |
|
106 |
---
|
107 |
|
108 |
## π§ͺ Local Development
|
109 |
+
|
110 |
+
Clone and run locally:
|
111 |
+
|
112 |
```bash
|
113 |
+
git clone https://github.com/damoojeje/SmartManuals-AI.git
|
114 |
+
cd SmartManuals-AI
|
115 |
pip install -r requirements.txt
|
|
|
|
|
|
|
116 |
python app.py
|
117 |
```
|
118 |
|
119 |
+
> π Place your manuals inside the `Manuals/` directory before running.
|
120 |
+
|
121 |
---
|
122 |
|
123 |
+
## π¨π½βπ» Created By
|
124 |
+
|
125 |
+
**Damilare Eniolabi**
|
126 |
+
π§ [damilareeniolabi@gmail.com](mailto:damilareeniolabi@gmail.com)
|
127 |
+
π GitHub: [@damoojeje](https://github.com/damoojeje)
|
128 |
|
129 |
---
|
130 |
|
131 |
+
## π Tags
|
132 |
+
|
133 |
+
`RAG` Β· `LLM` Β· `Gradio` Β· `ChromaDB` Β· `OCR` Β· `SemanticSearch` Β· `PDF` Β· `Word` Β· `SmartManualsAI` Β· `EquipmentQA`
|