Spaces:
Sleeping
Sleeping
Update README.md
Browse files
README.md
CHANGED
|
@@ -7,5 +7,81 @@ sdk: docker
|
|
| 7 |
pinned: false
|
| 8 |
license: apache-2.0
|
| 9 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
-
Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference
|
|
|
|
| 7 |
pinned: false
|
| 8 |
license: apache-2.0
|
| 9 |
---
|
| 10 |
+
# π€ Portfolio-AI β The Backend Brain of My Portfolio
|
| 11 |
+
|
| 12 |
+
> A RAG-powered AI that knows everything I've built β and can talk about it.
|
| 13 |
+
|
| 14 |
+
**Live Site β [aaravkumarranjan.netlify.app](https://aaravkumarranjan.netlify.app)**
|
| 15 |
+
|
| 16 |
+
---
|
| 17 |
+
|
| 18 |
+
## What Is This?
|
| 19 |
+
|
| 20 |
+
This is the backend powering the AI chat feature on my personal portfolio. Instead of a static "About Me" page, visitors can actually *talk* to my portfolio β asking about my projects, my stack, how I learn, or anything else.
|
| 21 |
+
|
| 22 |
+
Under the hood, it's a **Retrieval-Augmented Generation (RAG)** system built from scratch. The knowledge base is a PDF of my portfolio content. When someone asks a question, the system retrieves the most relevant chunks from that PDF and passes them to an LLM to generate a grounded, accurate answer.
|
| 23 |
+
|
| 24 |
+
This backend is built on the same architecture as Documind, adapted specifically to power the AI chat feature on my personal portfolio.
|
| 25 |
+
|
| 26 |
+
|
| 27 |
+
|
| 28 |
+
---
|
| 29 |
+
|
| 30 |
+
## Architecture
|
| 31 |
+
|
| 32 |
+
```
|
| 33 |
+
portfolio.pdf β loader β chunker β embedder β vector store
|
| 34 |
+
β
|
| 35 |
+
User Question β embed query β cosine similarity β top chunks
|
| 36 |
+
β
|
| 37 |
+
LLM β Answer
|
| 38 |
+
```
|
| 39 |
+
|
| 40 |
+
| Module | Role |
|
| 41 |
+
|---|---|
|
| 42 |
+
| `loader.py` | Extracts text from `portfolio.pdf` |
|
| 43 |
+
| `chunker.py` | Splits text into overlapping chunks |
|
| 44 |
+
| `embedder.py` | Generates semantic embeddings via `sentence-transformers` |
|
| 45 |
+
| `vector.py` | In-memory vector store for chunk embeddings |
|
| 46 |
+
| `retriever.py` | Cosine similarity search β returns top-k relevant chunks |
|
| 47 |
+
| `app.py` | FastAPI server that ties everything together |
|
| 48 |
+
|
| 49 |
+
---
|
| 50 |
+
|
| 51 |
+
## Why Build This Instead of Using a Library?
|
| 52 |
+
|
| 53 |
+
Because I wanted to understand what's actually happening. LangChain and LlamaIndex are great tools, but they abstract away the parts I care most about β how chunking affects retrieval quality, how similarity thresholds prevent hallucination, how the pipeline actually flows end to end.
|
| 54 |
+
|
| 55 |
+
This project is both a portfolio feature and a learning exercise.
|
| 56 |
+
|
| 57 |
+
---
|
| 58 |
+
|
| 59 |
+
## Tech Stack
|
| 60 |
+
|
| 61 |
+
**Backend:** Python, FastAPI, Sentence Transformers, scikit-learn, NumPy, PyPDF2
|
| 62 |
+
**Deployment:** Render
|
| 63 |
+
**Connected Frontend:** [aaravkumarranjan.netlify.app](https://aaravkumarranjan.netlify.app)
|
| 64 |
+
|
| 65 |
+
---
|
| 66 |
+
|
| 67 |
+
## Local Setup
|
| 68 |
+
|
| 69 |
+
```bash
|
| 70 |
+
git clone https://huggingface.co/spaces/Aaravkumar/documind
|
| 71 |
+
cd Portfolio-ai
|
| 72 |
+
pip install -r requirements.txt
|
| 73 |
+
uvicorn app:app --reload
|
| 74 |
+
```
|
| 75 |
+
|
| 76 |
+
Replace `portfolio.pdf` with your own PDF knowledge base to adapt this for your own portfolio.
|
| 77 |
+
|
| 78 |
+
---
|
| 79 |
+
|
| 80 |
+
## Author
|
| 81 |
+
|
| 82 |
+
**Aarav Kumar Ranjan**
|
| 83 |
+
|
| 84 |
+
[Portfolio](https://aaravkumarranjan.netlify.app) Β· [GitHub](https://github.com/akop-cyber) Β· [Kaggle](https://kaggle.com/aaravkumarranjan)
|
| 85 |
+
|
| 86 |
+
|
| 87 |
|
|
|