varshasharma01 commited on
Commit
ffbba1a
Β·
verified Β·
1 Parent(s): dca89c3

Update README.md

Browse files
Files changed (1) hide show
  1. README.md +48 -151
README.md CHANGED
@@ -1,10 +1,21 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
  # πŸ” ContextHub β€” Multimodal RAG Intelligence Platform
2
 
3
  <div align="center">
4
 
5
  ![Python](https://img.shields.io/badge/Python-3.10+-blue?style=for-the-badge&logo=python)
6
- ![FastAPI](https://img.shields.io/badge/FastAPI-0.110-009688?style=for-the-badge&logo=fastapi)
7
- ![Streamlit](https://img.shields.io/badge/Streamlit-1.32-FF4B4B?style=for-the-badge&logo=streamlit)
8
  ![Pinecone](https://img.shields.io/badge/Pinecone-Vector_DB-black?style=for-the-badge)
9
  ![Groq](https://img.shields.io/badge/Groq-LLaMA_3.3-orange?style=for-the-badge)
10
 
@@ -16,8 +27,9 @@
16
 
17
  ## πŸ“Œ What is ContextHub?
18
 
19
- ContextHub is a **Retrieval-Augmented Generation (RAG)** platform that lets you upload any source of information and query it using natural language.
20
- Unlike general-purpose AI, ContextHub answers **only from your uploaded content** β€” no hallucinations, no guesswork.
 
21
 
22
  ---
23
 
@@ -25,174 +37,59 @@ Unlike general-purpose AI, ContextHub answers **only from your uploaded content*
25
 
26
  | Mode | Input | Model Used |
27
  |------|-------|-----------|
28
- | πŸ“„ PDF Analysis | Upload any PDF | Groq β€” LLaMA 3.3 70B |
29
- | πŸ–ΌοΈ Image Intelligence | JPG / PNG | Google Gemini Vision |
30
- | πŸ”— Web Intelligence | Any public URL | Groq β€” LLaMA 3.3 70B |
31
- | πŸŽ₯ YouTube Intelligence | YouTube URL | Groq β€” LLaMA 3.3 70B |
32
 
33
- - 🧠 **Nomic Embeddings** β€” semantic vector search
34
- - πŸ“¦ **Pinecone** β€” isolated namespaces per source, no data bleed
35
- - ⚑ **Groq** β€” ultra-fast LLM inference
36
- - πŸ‘οΈ **Gemini** β€” multimodal image understanding
37
- - πŸ–₯️ **Streamlit** β€” clean tabbed UI with session management
38
 
39
  ---
40
 
41
- ## 🧠 Architecture
42
 
43
- ### PDF & YouTube β€” RAG Pipeline
44
- ```
45
- Input β†’ Text Extraction β†’ Chunking β†’ Nomic Embeddings
46
- β†’ Pinecone (isolated namespace) β†’ Similarity Search
47
- β†’ Top-K Chunks β†’ Groq LLM β†’ Answer
48
- ```
49
-
50
- ### Image β€” Vision Pipeline
51
- ```
52
- Image Upload β†’ Base64 Encode β†’ Gemini Vision API β†’ Answer
53
- ```
54
-
55
- ### URL β€” Web Pipeline
56
- ```
57
- URL β†’ BeautifulSoup Scraping β†’ Groq LLM β†’ Answer
58
- ```
59
-
60
- ---
61
 
62
- ## πŸ“ Project Structure
63
-
64
- ```
65
- context-hub/
66
- β”‚
67
- β”œβ”€β”€ backend/
68
- β”‚ β”œβ”€β”€ main.py # FastAPI server β€” all routes & RAG logic
69
- β”‚ └── .env # API keys (never commit this)
70
- β”‚
71
- β”œβ”€β”€ frontend/
72
- β”‚ └── app.py # Streamlit UI β€” tabs, session state, previews
73
- β”‚
74
- β”œβ”€β”€ requirements.txt # All Python dependencies
75
- β”œβ”€β”€ run.sh # One-command startup script
76
- β”œβ”€β”€ .gitignore
77
- └── README.md
78
- ```
79
 
80
  ---
81
 
82
- ## βš™οΈ Setup & Installation
83
-
84
- ### 1. Clone the Repository
85
-
86
- ```bash
87
- git clone https://github.com/varshasharma01/Context-Hub.git
88
- cd context-hub
89
- ```
90
-
91
- ### 2. Install Dependencies
92
-
93
- ```bash
94
- pip install -r requirements.txt
95
- ```
96
-
97
- ### 3. Configure Environment Variables
98
-
99
- Create a `.env` file inside the `backend/` folder:
100
-
101
- ```env
102
- GROQ_API_KEY=your_groq_api_key
103
- GEMINI_API_KEY=your_gemini_api_key
104
- PINECONE_API_KEY=your_pinecone_api_key
105
- NOMIC_API_KEY=your_nomic_api_key
106
- ```
107
-
108
- > **Get your keys from:**
109
- > - Groq β†’ https://console.groq.com
110
- > - Gemini β†’ https://aistudio.google.com
111
- > - Pinecone β†’ https://app.pinecone.io
112
- > - Nomic β†’ https://atlas.nomic.ai
113
 
114
- ### 4. Run the Project (One Command)
115
 
116
- ```bash
117
- chmod +x run.sh # first time only
118
- ./run.sh
119
- ```
120
-
121
- This starts both servers together:
122
- - βš™οΈ FastAPI backend β†’ `http://localhost:8000`
123
- - πŸ–₯️ Streamlit frontend β†’ `http://localhost:8501`
124
-
125
- > **Or run manually in two terminals:**
126
- > ```bash
127
- > # Terminal 1
128
- > uvicorn backend.main:app --reload
129
- >
130
- > # Terminal 2
131
- > streamlit run frontend/app.py
132
- > ```
133
-
134
- ---
135
-
136
- ## πŸ”— API Endpoints
137
-
138
- | Method | Endpoint | Description |
139
- |--------|----------|-------------|
140
- | `POST` | `/upload` | Upload & index a PDF |
141
- | `POST` | `/query` | Query the indexed PDF |
142
- | `POST` | `/process-image` | Upload & store an image |
143
- | `POST` | `/query-image` | Query the image via Gemini |
144
- | `POST` | `/process-url` | Scrape & store a webpage |
145
- | `POST` | `/query-url` | Query the webpage content |
146
- | `POST` | `/process-youtube` | Fetch & index YouTube transcript |
147
- | `POST` | `/query-youtube` | Query the video transcript |
148
 
149
  ---
150
 
151
  ## πŸ› οΈ Tech Stack
152
 
153
- | Layer | Technology |
154
- |-------|-----------|
155
- | Frontend | Streamlit |
156
- | Backend | FastAPI |
157
- | LLM (Text) | Groq β€” LLaMA 3.3 70B Versatile |
158
- | LLM (Vision) | Google Gemini |
159
- | Embeddings | Nomic Embed Text v1 / Vision v1.5 |
160
- | Vector Database | Pinecone |
161
- | PDF Parsing | PyMuPDF (fitz) |
162
- | Web Scraping | BeautifulSoup4 |
163
- | Transcripts | youtube-transcript-api |
164
-
165
- ---
166
-
167
- ## ⚑ Key Highlights
168
-
169
- - **True multimodal RAG** β€” 4 input types in one platform
170
- - **Namespace isolation** β€” each source gets its own Pinecone namespace, zero data bleed between uploads
171
- - **Session-aware UI** β€” answers clear on new uploads, no stale responses
172
- - **Dual AI providers** β€” Groq for speed, Gemini for vision
173
- - **One-command startup** β€” `run.sh` boots both servers together
174
-
175
- ---
176
-
177
- ## πŸš€ Future Improvements
178
-
179
- - [ ] Chat history with memory
180
- - [ ] Multi-document support (query across multiple PDFs)
181
- - [ ] YouTube timestamp-based answers
182
- - [ ] Streaming responses
183
- - [ ] Docker containerization
184
- - [ ] Cloud deployment (Render + Streamlit Cloud)
185
 
186
  ---
187
 
188
  ## πŸ‘©β€πŸ’» Author
189
 
190
- **Varsha Sharma**
191
-
192
- [![GitHub](https://img.shields.io/badge/GitHub-varshasharma01-black?style=flat&logo=github)](https://github.com/varshasharma01)
193
 
194
  ---
195
 
196
- ## ⭐ Support
197
-
198
- If you found this useful, consider giving it a ⭐ on GitHub !
 
1
+ ---
2
+ title: ContextHub
3
+ emoji: πŸ€–
4
+ colorFrom: blue
5
+ colorTo: green
6
+ sdk: streamlit
7
+ sdk_version: "1.33.0"
8
+ python_version: "3.10"
9
+ app_file: app.py
10
+ pinned: false
11
+ ---
12
+
13
  # πŸ” ContextHub β€” Multimodal RAG Intelligence Platform
14
 
15
  <div align="center">
16
 
17
  ![Python](https://img.shields.io/badge/Python-3.10+-blue?style=for-the-badge&logo=python)
18
+ ![Streamlit](https://img.shields.io/badge/Streamlit-1.33-FF4B4B?style=for-the-badge&logo=streamlit)
 
19
  ![Pinecone](https://img.shields.io/badge/Pinecone-Vector_DB-black?style=for-the-badge)
20
  ![Groq](https://img.shields.io/badge/Groq-LLaMA_3.3-orange?style=for-the-badge)
21
 
 
27
 
28
  ## πŸ“Œ What is ContextHub?
29
 
30
+ ContextHub is a **Retrieval-Augmented Generation (RAG)** platform hosted on Hugging Face Spaces. It allows you to upload various data sources and query them using natural language.
31
+
32
+ Unlike general-purpose AI, ContextHub answers **only from your uploaded content** β€” ensuring zero hallucinations and total data grounding.
33
 
34
  ---
35
 
 
37
 
38
  | Mode | Input | Model Used |
39
  |------|-------|-----------|
40
+ | πŸ“„ **PDF Analysis** | Upload any PDF | Groq β€” LLaMA 3.3 |
41
+ | πŸ–ΌοΈ **Image Intelligence** | JPG / PNG | Google Gemini Vision |
42
+ | πŸ”— **Web Intelligence** | Public URL | Groq β€” LLaMA 3.3 |
43
+ | πŸŽ₯ **YouTube Intelligence** | YouTube URL | Groq β€” LLaMA 3.3 |
44
 
45
+ - 🧠 **Nomic Embeddings** β€” semantic vector search.
46
+ - πŸ“¦ **Pinecone** β€” isolated namespaces per source to prevent data bleed.
47
+ - ⚑ **Groq** β€” ultra-fast LLM inference for near-instant answers.
48
+ - πŸ–₯️ **Streamlit** β€” native Hugging Face integration for a smooth UI.
 
49
 
50
  ---
51
 
52
+ ## 🧠 Architecture on Spaces
53
 
54
+ Since this is running in a Hugging Face Space, the FastAPI backend has been integrated directly into the Streamlit logic (`app.py`) for optimized performance within a single container.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
55
 
56
+ ### The Pipeline:
57
+ 1. **Ingestion**: Documents/URLs are parsed and chunked.
58
+ 2. **Embedding**: Text is converted to vectors via Nomic.
59
+ 3. **Storage**: Vectors are stored in Pinecone using unique session namespaces.
60
+ 4. **Retrieval**: Relevant context is pulled based on user queries.
61
+ 5. **Generation**: Groq (LLaMA 3.3) generates the final response based *only* on retrieved context.
 
 
 
 
 
 
 
 
 
 
 
62
 
63
  ---
64
 
65
+ ## πŸ” Environment Variables (Required)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
66
 
67
+ To run this Space, you must add the following **Secrets** in your Space Settings:
68
 
69
+ | Secret Key | Source |
70
+ |----------|----------|
71
+ | `GROQ_API_KEY` | [Groq Console](https://console.groq.com) |
72
+ | `GEMINI_API_KEY` | [Google AI Studio](https://aistudio.google.com) |
73
+ | `PINECONE_API_KEY` | [Pinecone Dashboard](https://app.pinecone.io) |
74
+ | `NOMIC_API_KEY` | [Nomic Atlas](https://atlas.nomic.ai) |
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
75
 
76
  ---
77
 
78
  ## πŸ› οΈ Tech Stack
79
 
80
+ - **UI Framework:** Streamlit
81
+ - **Orchestration:** LangChain
82
+ - **LLMs:** Groq (LLaMA 3.3 70B), Google Gemini 1.5 Pro
83
+ - **Vector Database:** Pinecone
84
+ - **Embeddings:** Nomic-Embed-Text-v1
85
+ - **Parsing:** BeautifulSoup4, PyPDF, youtube-transcript-api
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
86
 
87
  ---
88
 
89
  ## πŸ‘©β€πŸ’» Author
90
 
91
+ **Varsha Sharma** [![GitHub](https://img.shields.io/badge/GitHub-varshasharma01-black?style=flat&logo=github)](https://github.com/varshasharma01)
 
 
92
 
93
  ---
94
 
95
+ *Note: This Space is strictly for educational purposes and adheres to data grounding principles.*