Spaces:
Configuration error
Configuration error
Update Readme.md
Browse files
Readme.md
CHANGED
|
@@ -1,109 +1,11 @@
|
|
| 1 |
-
|
| 2 |
-
|
|
|
|
| 3 |
colorFrom: blue
|
| 4 |
-
colorTo:
|
| 5 |
sdk: gradio
|
| 6 |
-
sdk_version: "4.
|
| 7 |
python_version: "3.10"
|
| 8 |
app_file: app.py
|
| 9 |
pinned: false
|
| 10 |
-
|
| 11 |
-
Group 15 β CSAI 801
|
| 12 |
-
MemberRoleBassant YehiaDeveloperMennaalla AhmedDeveloperMariem BastarousDeveloper
|
| 13 |
-
Supervisor: Dr. Rahatara Ferdousi Β |Β TA: Eng. Salman Rakin
|
| 14 |
-
|
| 15 |
-
Project Overview
|
| 16 |
-
A content-based recommendation system that uses an LLM (DeepSeek-R1) to generate
|
| 17 |
-
personalised recommendations with natural-language explanations, addressing:
|
| 18 |
-
|
| 19 |
-
Cold-start problem β no user history needed; relies purely on semantic content
|
| 20 |
-
Lack of transparency β every recommendation includes a structured WHY
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
Architecture
|
| 24 |
-
PDF Knowledge Base
|
| 25 |
-
β
|
| 26 |
-
βΌ
|
| 27 |
-
PyMuPDFLoader β RecursiveCharacterTextSplitter
|
| 28 |
-
β
|
| 29 |
-
βΌ (1000-char chunks, 200 overlap)
|
| 30 |
-
OllamaEmbeddings (nomic-embed-text)
|
| 31 |
-
β [parallel via ThreadPoolExecutor]
|
| 32 |
-
βΌ
|
| 33 |
-
ChromaDB Vector Store
|
| 34 |
-
β
|
| 35 |
-
βββββββββββββ
|
| 36 |
-
β Semantic retrieval (Top-K chunks)
|
| 37 |
-
βΌ
|
| 38 |
-
ChatPromptTemplate (System + Human)
|
| 39 |
-
β
|
| 40 |
-
βΌ
|
| 41 |
-
ChatOllama (DeepSeek-R1, temp=0.5)
|
| 42 |
-
β
|
| 43 |
-
βΌ
|
| 44 |
-
StrOutputParser β Explainable Recommendation
|
| 45 |
-
β
|
| 46 |
-
ββββββββ΄βββββββ
|
| 47 |
-
βΌ βΌ
|
| 48 |
-
Gradio UI FastAPI Endpoint
|
| 49 |
-
|
| 50 |
-
Quick Start
|
| 51 |
-
1. Prerequisites
|
| 52 |
-
bash# Install Ollama (https://ollama.ai)
|
| 53 |
-
ollama pull nomic-embed-text
|
| 54 |
-
ollama pull deepseek-r1
|
| 55 |
-
|
| 56 |
-
# Install Python dependencies
|
| 57 |
-
pip install -r requirements.txt
|
| 58 |
-
2. Place your PDF
|
| 59 |
-
Put your Foundational_LLM.pdf in the project root directory.
|
| 60 |
-
3a. Run the Gradio UI
|
| 61 |
-
bashpython app.py
|
| 62 |
-
Opens at http://localhost:7860 (or the public share URL printed in the terminal).
|
| 63 |
-
3b. Run the FastAPI server
|
| 64 |
-
bashuvicorn api:app --host 0.0.0.0 --port 8000 --reload
|
| 65 |
-
Interactive API docs at http://localhost:8000/docs
|
| 66 |
-
|
| 67 |
-
API Endpoints
|
| 68 |
-
MethodPathDescriptionGET/healthHealth checkGET/infoProject & system metadataPOST/recommendSingle recommendation queryPOST/recommend/batchBatch queries (up to 10)
|
| 69 |
-
Example β Single Query
|
| 70 |
-
bashcurl -X POST http://localhost:8000/recommend \
|
| 71 |
-
-H "Content-Type: application/json" \
|
| 72 |
-
-d '{"question": "What techniques improve LLM reasoning?", "top_k": 5}'
|
| 73 |
-
Example β Batch Query
|
| 74 |
-
bashcurl -X POST http://localhost:8000/recommend/batch \
|
| 75 |
-
-H "Content-Type: application/json" \
|
| 76 |
-
-d '{
|
| 77 |
-
"questions": [
|
| 78 |
-
"What is prompt engineering?",
|
| 79 |
-
"How does RAG work?"
|
| 80 |
-
],
|
| 81 |
-
"top_k": 5
|
| 82 |
-
}'
|
| 83 |
-
|
| 84 |
-
Features vs. Traditional Systems
|
| 85 |
-
FeatureTraditional RSThis System (FM-based)Cold startWeakStrong (content-based)ExplainabilityLowHigh (structured WHY)ConversationalNoYesSetup speedSlowFastReasoningStatisticalSemantic
|
| 86 |
-
|
| 87 |
-
Project Scope (30 Hours)
|
| 88 |
-
Included β
|
| 89 |
-
|
| 90 |
-
Content-based recommendations
|
| 91 |
-
Embeddings + LLM explanations
|
| 92 |
-
API-only implementation (FastAPI)
|
| 93 |
-
Gradio prototype UI
|
| 94 |
-
|
| 95 |
-
Excluded β
|
| 96 |
-
|
| 97 |
-
Large-scale data
|
| 98 |
-
Collaborative filtering
|
| 99 |
-
Production frontend UI
|
| 100 |
-
Production deployment
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
File Structure
|
| 104 |
-
recommendation_system/
|
| 105 |
-
βββ app.py β Gradio UI + full RAG pipeline
|
| 106 |
-
βββ api.py β FastAPI REST endpoint
|
| 107 |
-
βββ requirements.txt β Python dependencies
|
| 108 |
-
βββ README.md β This file
|
| 109 |
-
βββ Foundational_LLM.pdf β Knowledge base (add manually)
|
|
|
|
| 1 |
+
---
|
| 2 |
+
title: Explainable LLaMA Recommendation System
|
| 3 |
+
emoji: π
|
| 4 |
colorFrom: blue
|
| 5 |
+
colorTo: purple
|
| 6 |
sdk: gradio
|
| 7 |
+
sdk_version: "4.44.0"
|
| 8 |
python_version: "3.10"
|
| 9 |
app_file: app.py
|
| 10 |
pinned: false
|
| 11 |
+
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|