# โœ… SmartManuals-AI for Hugging Face Spaces SmartManuals-AI is a local-first document QA system that uses RAG (retrieval-augmented generation), OCR, and embedding search to answer technical questions from PDFs **and Word documents**. --- ## ๐Ÿ”ง Features - ๐Ÿ” **Ask natural-language questions** to your manuals - ๐Ÿ“„ Handles both **PDFs** and **Word `.docx`** files - ๐Ÿง  Uses **semantic search** with `sentence-transformers` - ๐Ÿ—ƒ๏ธ ChromaDB for fast local vector indexing - ๐Ÿ’ฌ Answers generated by **Meta LLaMA 3.1 8B Instruct** (default) - ๐Ÿ“Š Gradio dashboard for interaction --- ## ๐Ÿ“ Folder Structure ``` SmartManuals-AI/ โ”œโ”€โ”€ app.py # Hugging Face Spaces main app โ”œโ”€โ”€ Manuals/ # ๐Ÿ“‚ Upload your PDF and Word manuals here โ”‚ โ”œโ”€โ”€ OM_Treadmill.pdf โ”‚ โ””โ”€โ”€ Parts_Bike.docx โ”œโ”€โ”€ chroma_store/ # โ›“๏ธ ChromaDB vector DB (auto-generated) โ”œโ”€โ”€ requirements.txt # ๐Ÿ“ฆ Dependencies โ””โ”€โ”€ README.md # ๐Ÿ“– This file ``` --- ## ๐Ÿš€ Usage in Hugging Face Spaces ### ๐Ÿ” Environment Variables Add your Hugging Face token as a secret: - `HF_TOKEN`: Your Hugging Face access token (required for gated models) ### ๐Ÿ“ค Upload Your Files Put all your manuals (PDF and Word `.docx`) into the `Manuals/` folder. ### ๐Ÿง  App Behavior - On startup: - Extracts text (with OCR fallback) from PDFs - Extracts clean text from Word documents - Chunks and embeds content into ChromaDB - During inference: - Retrieves semantically relevant chunks - Sends them to LLaMA 3.1 Instruct for answer generation ### โŒ No User Upload This app is **designed to work without file uploads**. All processing is done on preloaded files in the `Manuals/` directory. --- ## ๐Ÿง  Default Model - Uses **`meta-llama/Llama-3.1-8B-Instruct`** - All question answering is **fully automatic** - User is **not required to pick a model, doc type, or filter** โ€” the system decides based on question and content. --- ## ๐Ÿงฉ Supported File Types - `.pdf` (with OCR for scanned pages) - `.docx` (via `python-docx`) --- ## ๐Ÿงช Local Development Install dependencies: ```bash pip install -r requirements.txt ``` Run locally: ```bash python app.py ``` --- ## ๐Ÿ‘จ๐Ÿฝโ€๐Ÿ’ป Project by: [Damilare Eniolabi](mailto:damilareeniolabi@gmail.com) GitHub: [@damoojeje](https://github.com/damoojeje) --- ## ๐Ÿ“Œ Tags `RAG` `LLM` `Chroma` `OCR` `PDF` `Word` `Gradio` `HuggingFace` `SmartManualsAI`