Sarath0x8f commited on
Commit
f32ea1e
·
verified ·
1 Parent(s): baab591

Upload 2 files

Browse files
Files changed (2) hide show
  1. app.py +159 -139
  2. markdown.py +153 -42
app.py CHANGED
@@ -1,140 +1,160 @@
1
- import gradio as gr
2
- import pymongo
3
- import certifi
4
- from llama_index.core import VectorStoreIndex
5
- from llama_index.embeddings.huggingface import HuggingFaceEmbedding
6
- from llama_index.llms.groq import Groq
7
- from llama_index.vector_stores.mongodb import MongoDBAtlasVectorSearch
8
- from llama_index.core.prompts import PromptTemplate
9
- from dotenv import load_dotenv
10
- import os
11
- import base64
12
- import markdown as md
13
- from datetime import datetime
14
-
15
- # Load environment variables
16
- load_dotenv()
17
-
18
- # --- MongoDB Config ---
19
- ATLAS_CONNECTION_STRING = os.getenv("ATLAS_CONNECTION_STRING")
20
- DB_NAME = "RAG"
21
- COLLECTION_NAME = "ramayana"
22
- VECTOR_INDEX_NAME = "ramayana_vector_index"
23
-
24
- # --- Embedding Model ---
25
- embed_model = HuggingFaceEmbedding(model_name="intfloat/multilingual-e5-base")
26
-
27
- # --- Prompt Template ---
28
- ramayana_qa_template = PromptTemplate(
29
- """You are an expert on the Valmiki Ramayana and a guide who always inspires people with the great Itihasa like the Ramayana.
30
-
31
- Below is text from the epic, including shlokas and their explanations:
32
- ---------------------
33
- {context_str}
34
- ---------------------
35
-
36
- Using only this information, answer the following query.
37
-
38
- Query: {query_str}
39
-
40
- Answer:
41
- - Intro or general description to ```Query```
42
- - Related shloka/shlokas followed by its explanation
43
- - Overview of ```Query```
44
- """
45
- )
46
-
47
- # --- Connect to MongoDB once at startup ---
48
- def get_vector_index_once():
49
- mongo_client = pymongo.MongoClient(
50
- ATLAS_CONNECTION_STRING,
51
- tlsCAFile=certifi.where(),
52
- tlsAllowInvalidCertificates=False,
53
- connectTimeoutMS=30000,
54
- serverSelectionTimeoutMS=30000,
55
- )
56
- mongo_client.server_info()
57
- print("✅ Connected to MongoDB Atlas.")
58
-
59
- vector_store = MongoDBAtlasVectorSearch(
60
- mongo_client,
61
- db_name=DB_NAME,
62
- collection_name=COLLECTION_NAME,
63
- vector_index_name=VECTOR_INDEX_NAME,
64
- )
65
- return VectorStoreIndex.from_vector_store(vector_store, embed_model=embed_model)
66
-
67
- # Connect once
68
- vector_index = get_vector_index_once()
69
-
70
- # --- Respond Function (uses API key from state) ---
71
- def chat_with_groq(message, history, groq_key):
72
- llm = Groq(model="llama-3.1-8b-instant", api_key=groq_key)
73
-
74
- query_engine = vector_index.as_query_engine(
75
- llm=llm,
76
- text_qa_template=ramayana_qa_template,
77
- similarity_top_k=5,
78
- verbose=True,
79
- )
80
-
81
- response = query_engine.query(message)
82
- print(f"\n{datetime.now()}:: {message} --> {str(response)}\n")
83
- return str(response)
84
-
85
- def encode_image(image_path):
86
- with open(image_path, "rb") as image_file:
87
- return base64.b64encode(image_file.read()).decode('utf-8')
88
-
89
- # Encode the images
90
- github_logo_encoded = encode_image("Images/github-logo.png")
91
- linkedin_logo_encoded = encode_image("Images/linkedin-logo.png")
92
- website_logo_encoded = encode_image("Images/ai-logo.png")
93
-
94
- # --- Gradio UI ---
95
- with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Roboto Mono")]), css='footer {visibility: hidden}') as demo:
96
- with gr.Tabs():
97
- with gr.TabItem("Intro"):
98
- gr.Markdown(md.description)
99
-
100
- with gr.TabItem("GPT"):
101
- with gr.Column(visible=True) as accordion_container:
102
- with gr.Accordion("How to get Groq API KEY", open=False):
103
- gr.Markdown(md.groq_api_key)
104
-
105
- groq_key_box = gr.Textbox(
106
- label="Enter Groq API Key",
107
- type="password",
108
- placeholder="Paste your Groq API key here..."
109
- )
110
-
111
- start_btn = gr.Button("Start Chat")
112
-
113
- groq_state = gr.State(value="")
114
-
115
- # Chat container, initially hidden
116
- with gr.Column(visible=False) as chatbot_container:
117
- chatbot = gr.ChatInterface(
118
- fn=lambda message, history, groq_key: chat_with_groq(message, history, groq_key),
119
- additional_inputs=[groq_state],
120
- chatbot=gr.Chatbot(height=500),
121
- title="🕉️ RamayanaGPT",
122
- show_progress="full",
123
- fill_height=True,
124
- # description="Ask questions from the Valmiki Ramayana. Powered by RAG + MongoDB + LlamaIndex.",
125
- )
126
-
127
- # Show chat and hide inputs
128
- def save_key_and_show_chat(key):
129
- print(f"key: {key}")
130
- return key, gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=True)
131
-
132
- start_btn.click(
133
- fn=save_key_and_show_chat,
134
- inputs=[groq_key_box],
135
- outputs=[groq_state, groq_key_box, start_btn, accordion_container, chatbot_container]
136
- )
137
- gr.HTML(md.footer.format(github_logo_encoded, linkedin_logo_encoded, website_logo_encoded))
138
-
139
- if __name__ == "__main__":
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
140
  demo.launch()
 
1
+ import gradio as gr
2
+ import pymongo
3
+ import certifi
4
+ from llama_index.core import VectorStoreIndex
5
+ from llama_index.embeddings.huggingface import HuggingFaceEmbedding
6
+ from llama_index.llms.groq import Groq
7
+ from llama_index.vector_stores.mongodb import MongoDBAtlasVectorSearch
8
+ from llama_index.core.prompts import PromptTemplate
9
+ from dotenv import load_dotenv
10
+ import os
11
+ import base64
12
+ import markdown as md
13
+ from datetime import datetime
14
+
15
+ # Load environment variables
16
+ load_dotenv()
17
+
18
+ # --- Embedding Model ---
19
+ embed_model = HuggingFaceEmbedding(model_name="intfloat/multilingual-e5-base")
20
+
21
+ # --- Prompt Template ---
22
+ ramayana_qa_template = PromptTemplate(
23
+ """You are an expert on the Valmiki Ramayana and a guide who always inspires people with the great Itihasa like the Ramayana.
24
+
25
+ Below is text from the epic, including shlokas and their explanations:
26
+ ---------------------
27
+ {context_str}
28
+ ---------------------
29
+
30
+ Using only this information, answer the following query.
31
+
32
+ Query: {query_str}
33
+
34
+ Answer:
35
+ - Intro or general description to ```Query```
36
+ - Related shloka/shlokas followed by its explanation
37
+ - Overview of ```Query```"""
38
+ )
39
+
40
+ gita_qa_template = PromptTemplate(
41
+ """You are an expert on the Bhagavad Gita and a spiritual guide.
42
+
43
+ Below is text from the scripture, including verses and their explanations:
44
+ ---------------------
45
+ {context_str}
46
+ ---------------------
47
+
48
+ Using only this information, answer the following query.
49
+
50
+ Query: {query_str}
51
+
52
+ Answer:
53
+ - Intro or context about the topic
54
+ - Relevant verse(s) with explanation
55
+ - Conclusion or reflection"""
56
+ )
57
+
58
+ # --- Connect to MongoDB once at startup ---
59
+ def get_vector_index(db_name, collection_name, vector_index_name):
60
+ mongo_client = pymongo.MongoClient(
61
+ os.getenv("ATLAS_CONNECTION_STRING"),
62
+ tlsCAFile=certifi.where(),
63
+ tlsAllowInvalidCertificates=False,
64
+ connectTimeoutMS=30000,
65
+ serverSelectionTimeoutMS=30000,
66
+ )
67
+ mongo_client.server_info()
68
+ print(f"✅ Connected to MongoDB Atlas for collection: {collection_name}")
69
+
70
+ vector_store = MongoDBAtlasVectorSearch(
71
+ mongo_client,
72
+ db_name=db_name,
73
+ collection_name=collection_name,
74
+ vector_index_name=vector_index_name,
75
+ )
76
+ return VectorStoreIndex.from_vector_store(vector_store, embed_model=embed_model)
77
+
78
+ # --- Respond Function (uses API key from state) ---
79
+ def chat_with_groq(index, template):
80
+ def fn(message, history, groq_key):
81
+ if not groq_key or not groq_key.startswith("gsk_"):
82
+ return "❌ Invalid Groq API Key. Please enter a valid key."
83
+ llm = Groq(model="llama-3.1-8b-instant", api_key=groq_key)
84
+ query_engine = index.as_query_engine(
85
+ llm=llm,
86
+ text_qa_template=template,
87
+ similarity_top_k=5,
88
+ verbose=True,
89
+ )
90
+ response = query_engine.query(message)
91
+ print(f"\n{datetime.now()}:: {message} --> {str(response)}\n")
92
+ return str(response)
93
+ return fn
94
+
95
+ # Load vector indices once
96
+ ramayana_index = get_vector_index("RAG", "ramayana", "ramayana_vector_index")
97
+ gita_index = get_vector_index("RAG", "bhagavad_gita", "gita_vector_index")
98
+
99
+ # Encode logos
100
+
101
+ def encode_image(image_path):
102
+ with open(image_path, "rb") as image_file:
103
+ return base64.b64encode(image_file.read()).decode("utf-8")
104
+
105
+ github_logo_encoded = encode_image("Images/github-logo.png")
106
+ linkedin_logo_encoded = encode_image("Images/linkedin-logo.png")
107
+ website_logo_encoded = encode_image("Images/ai-logo.png")
108
+
109
+ # --- Gradio UI ---
110
+ with gr.Blocks(theme=gr.themes.Soft(font=[gr.themes.GoogleFont("Roboto Mono")]), css='footer {visibility: hidden}') as demo:
111
+ with gr.Tabs():
112
+ with gr.TabItem("Intro"):
113
+ gr.Markdown(md.description)
114
+
115
+ def create_tab(tab_title, chatbot_title, vector_index, template, intro):
116
+ with gr.TabItem(tab_title):
117
+ with gr.Column(visible=True) as accordion_container:
118
+ with gr.Accordion("How to get Groq API KEY", open=False):
119
+ gr.Markdown(md.groq_api_key)
120
+
121
+ groq_key_box = gr.Textbox(
122
+ label="Enter Groq API Key",
123
+ type="password",
124
+ placeholder="Paste your Groq API key here..."
125
+ )
126
+
127
+ start_btn = gr.Button("Start Chat")
128
+ groq_state = gr.State(value="")
129
+
130
+ with gr.Column(visible=False) as chatbot_container:
131
+ with gr.Accordion("Overview & Summary", open=False):
132
+ gr.Markdown(intro)
133
+ chatbot = gr.ChatInterface(
134
+ fn=chat_with_groq(vector_index, template),
135
+ additional_inputs=[groq_state],
136
+ chatbot=gr.Chatbot(height=500),
137
+ title=chatbot_title,
138
+ show_progress="full",
139
+ fill_height=True,
140
+ )
141
+
142
+ def save_key_and_show_chat(key):
143
+ if key and key.startswith("gsk_"):
144
+ return key, gr.update(visible=False), gr.update(visible=False), gr.update(visible=False), gr.update(visible=True)
145
+ else:
146
+ return "", gr.update(visible=True), gr.update(visible=True), gr.update(visible=True), gr.update(visible=False)
147
+
148
+ start_btn.click(
149
+ fn=save_key_and_show_chat,
150
+ inputs=[groq_key_box],
151
+ outputs=[groq_state, groq_key_box, start_btn, accordion_container, chatbot_container]
152
+ )
153
+
154
+ create_tab("RamayanaGPT", "🕉️ RamayanaGPT", ramayana_index, ramayana_qa_template, md.RamayanaGPT)
155
+ create_tab("GitaGPT", "🕉️ GitaGPT", gita_index, gita_qa_template, md.GitaGPT)
156
+
157
+ gr.HTML(md.footer.format(github_logo_encoded, linkedin_logo_encoded, website_logo_encoded))
158
+
159
+ if __name__ == "__main__":
160
  demo.launch()
markdown.py CHANGED
@@ -1,11 +1,19 @@
1
  description = """
2
- ## 🕉️ **Project Title: RamayanaGPT – A RAG-based Chatbot for Valmiki Ramayana**
3
 
4
  ---
5
 
6
  ### 🔍 **Project Overview**
7
 
8
- **RamayanaGPT** is a knowledge-based conversational chatbot designed to answer questions from the *Valmiki Ramayana*. It leverages advanced **Retrieval-Augmented Generation (RAG)** principles to provide accurate and context-rich responses by referencing canonical verses (*shlokas*) and their explanations. This project integrates **MongoDB Atlas**, **LlamaIndex**, **Groq LLM**, and **Gradio UI**, offering an intuitive and scholarly digital assistant for users curious about the ancient epic.
 
 
 
 
 
 
 
 
9
 
10
  ---
11
 
@@ -13,72 +21,99 @@ description = """
13
 
14
  #### 1. **Vector Store: MongoDB Atlas**
15
 
16
- * The *Valmiki Ramayana* dataset is stored in a MongoDB Atlas collection.
17
- * Each document consists of metadata fields: `kanda`, `sarga`, `shloka`, and `shloka_text`, with an `explanation` used for semantic retrieval.
18
- * MongoDB Atlas Vector Search is configured using `MongoDBAtlasVectorSearch` for efficient similarity-based queries.
 
 
 
 
 
 
19
 
20
- #### 2. **Embeddings: Hugging Face**
 
21
 
22
- * Embedding model: `intfloat/multilingual-e5-base` from HuggingFace.
23
- * Converts shloka and explanation texts into vector representations for similarity search.
 
 
 
24
 
25
  #### 3. **Language Model: Groq API**
26
 
27
- * Model used: `llama-3.1-8b-instant`.
28
- * API key is provided at runtime by the user.
29
- * Integrates with the query engine to synthesize responses based on context-relevant documents.
30
 
31
  #### 4. **Prompt Engineering**
32
 
33
- * A custom `PromptTemplate` guides the LLM to:
 
 
 
 
 
 
34
 
35
- * Provide an introduction.
36
- * Quote relevant shlokas.
37
- * Explain them.
38
- * Give a closing summary relevant to the query.
39
- * Prompt ensures scholarly tone and contextual accuracy.
40
 
41
- #### 5. **Vector Index**
42
 
43
- * Built once during app startup using `VectorStoreIndex.from_vector_store()`.
44
- * Shared across user queries to prevent repeated MongoDB connections (for efficiency and speed).
 
 
 
 
 
45
 
46
  #### 6. **User Interface: Gradio**
47
 
48
- * Tabbed interface using `gr.Blocks` with a clean `Soft` theme and Google Fonts.
49
- * Users input their Groq API key.
50
- * After key submission:
 
 
 
 
51
 
52
- * API key input and button are hidden.
53
- * Chat interface is shown using `gr.ChatInterface`.
54
- * Uses `gr.State` to hold the Groq API key during the session.
55
 
56
  ---
57
 
58
  ### ⚙️ **Technical Stack**
59
 
60
- | Component | Technology |
61
- | --------------- | ----------------------------------- |
62
- | Backend LLM | Groq (LLaMA 3.1 8B via API) |
63
- | Embedding Model | Hugging Face (multilingual-e5-base) |
64
- | Vector Store | MongoDB Atlas Vector Search |
65
- | Query Engine | LlamaIndex |
66
- | Prompt Engine | LlamaIndex PromptTemplate |
67
- | UI Framework | Gradio (Blocks + ChatInterface) |
68
- | Deployment | Python app using `app.py` |
 
69
 
70
  ---
71
 
72
  ### ✅ **Features Implemented**
73
 
74
- * [x] Connection to MongoDB Atlas (once during app startup).
75
- * [x] API key input and secure state handling using `gr.State`.
76
- * [x] Vector search over embedded shloka data.
77
- * [x] Chat interface with dynamic UI (hides API key and button post-auth).
78
- * [x] RAG-based responses tailored to Valmiki Ramayana structure.
79
- * [x] Modular, clean design for future extensibility (e.g., Bhagavad Gita, Mahabharata).
 
 
 
 
 
80
 
81
- ---
82
  """
83
 
84
  groq_api_key = """
@@ -96,6 +131,82 @@ groq_api_key = """
96
  ⚠️ **Don't share** your API key. Revoke and regenerate if needed.
97
  """
98
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
99
  footer = """
100
  <div style="background-color: #1d2938; color: white; padding: 10px; width: 100%; bottom: 0; left: 0; display: flex; justify-content: space-between; align-items: center; padding: .2rem 35px; box-sizing: border-box; font-size: 16px;">
101
  <div style="text-align: left;">
 
1
  description = """
2
+ ## 🕉️ **Project Title: RamayanaGPT & GitaGPT – RAG-based Chatbots for Ancient Indian Epics**
3
 
4
  ---
5
 
6
  ### 🔍 **Project Overview**
7
 
8
+ **RamayanaGPT** and **GitaGPT** are knowledge-based conversational AI tools designed to answer questions from the *Valmiki Ramayana* and the *Bhagavad Gita*, respectively. These chatbots use **Retrieval-Augmented Generation (RAG)** architecture to generate accurate, scripture-based responses. They combine powerful **vector search capabilities** with **large language models (LLMs)** to deliver spiritually insightful, context-rich conversations.
9
+
10
+ These tools leverage:
11
+
12
+ * **MongoDB Atlas Vector Search** for embedding-based document retrieval
13
+ * **Hugging Face** embeddings (`intfloat/multilingual-e5-base`)
14
+ * **Groq LLaMA 3.1 8B** via API
15
+ * **LlamaIndex** for orchestration
16
+ * **Gradio** for user interface
17
 
18
  ---
19
 
 
21
 
22
  #### 1. **Vector Store: MongoDB Atlas**
23
 
24
+ * Two collections are created in the `RAG` database:
25
+
26
+ * `ramayana` for **Valmiki Ramayana**
27
+ * `bhagavad_gita` for **Bhagavad Gita**
28
+ * Each collection contains vector indexes:
29
+
30
+ * `ramayana_vector_index`
31
+ * `gita_vector_index`
32
+ * Each document includes:
33
 
34
+ * For Ramayana: `kanda`, `sarga`, `shloka`, `shloka_text`, and `explanation`
35
+ * For Gita: `Title`, `Chapter`, `Verse`, and `explanation`
36
 
37
+ #### 2. **Vector Embedding: Hugging Face**
38
+
39
+ * Model: `intfloat/multilingual-e5-base`
40
+ * Used to convert `shloka_text + explanation` or `verse + explanation` into vector representations
41
+ * These embeddings are indexed into MongoDB for semantic similarity search
42
 
43
  #### 3. **Language Model: Groq API**
44
 
45
+ * LLM used: `llama-3.1-8b-instant` via **Groq API**
46
+ * Users input their Groq API key securely
47
+ * LLM is instantiated per query using `llama_index.llms.groq.Groq`
48
 
49
  #### 4. **Prompt Engineering**
50
 
51
+ * Custom **PromptTemplates** guide the response structure for each chatbot
52
+ * **RamayanaGPT Prompt**:
53
+
54
+ * Introduction to the query
55
+ * Related shlokas with explanations
56
+ * Summary/overview
57
+ * **GitaGPT Prompt**:
58
 
59
+ * Context or spiritual background
60
+ * Relevant verse(s) with meaning
61
+ * Reflective conclusion
 
 
62
 
63
+ #### 5. **Index Initialization**
64
 
65
+ * Vector indexes are loaded **once** at application startup:
66
+
67
+ ```python
68
+ ramayana_index = get_vector_index("RAG", "ramayana", "ramayana_vector_index")
69
+ gita_index = get_vector_index("RAG", "bhagavad_gita", "gita_vector_index")
70
+ ```
71
+ * Shared across all user queries for speed and efficiency
72
 
73
  #### 6. **User Interface: Gradio**
74
 
75
+ * Built with `gr.Blocks` using the `Soft` theme and `Roboto Mono` font
76
+ * Two tabs:
77
+
78
+ * 🕉️ **RamayanaGPT**
79
+ * 🕉️ **GitaGPT**
80
+ * Users enter their Groq API key once; it's stored in `gr.State`
81
+ * Upon authentication:
82
 
83
+ * API key input and help accordion are hidden
84
+ * Full chat interface is revealed (`gr.ChatInterface`)
 
85
 
86
  ---
87
 
88
  ### ⚙️ **Technical Stack**
89
 
90
+ | Component | Technology |
91
+ | --------------- | ------------------------------------- |
92
+ | Backend LLM | Groq (LLaMA 3.1 8B via API) |
93
+ | Embedding Model | Hugging Face (`multilingual-e5-base`) |
94
+ | Vector Store | MongoDB Atlas Vector Search |
95
+ | Vector Engine | LlamaIndex VectorStoreIndex |
96
+ | Prompt Engine | LlamaIndex PromptTemplate |
97
+ | Query Engine | LlamaIndex Query Engine |
98
+ | UI Framework | Gradio (Blocks + ChatInterface) |
99
+ | Deployment | Python app using `app.py` |
100
 
101
  ---
102
 
103
  ### ✅ **Features Implemented**
104
 
105
+ * [x] Vector search using MongoDB Atlas
106
+
107
+ * `ramayana_vector_index` for Valmiki Ramayana
108
+ * `gita_vector_index` for Bhagavad Gita
109
+ * [x] Hugging Face embedding (`e5-base`) integration
110
+ * [x] API key input and session handling with `gr.State`
111
+ * [x] LLM integration via Groq API
112
+ * [x] Prompt templates customized for each scripture
113
+ * [x] Tabbed interface for seamless switching between RamayanaGPT and GitaGPT
114
+ * [x] Clean UX with collapsible Groq API key instructions
115
+ * [x] Logging of each query with timestamp (for debugging/monitoring)
116
 
 
117
  """
118
 
119
  groq_api_key = """
 
131
  ⚠️ **Don't share** your API key. Revoke and regenerate if needed.
132
  """
133
 
134
+ RamayanaGPT='''
135
+ ## 🕉️ **RamayanaGPT – Overview and Dataset Summary**
136
+
137
+ ### 📖 **Introduction**
138
+
139
+ **RamayanaGPT** is a RAG-based chatbot that draws upon the **Valmiki Ramayana**, the original Sanskrit epic, to answer user queries with reference to shlokas and their commentaries. It aims to offer precise, contextual, and respectful responses using advanced retrieval and generation technologies.
140
+
141
+ ### 🗂️ **Dataset Structure**
142
+
143
+ The uploaded Ramayana dataset includes the following columns:
144
+
145
+ | Column | Description |
146
+ | ------------- | ------------------------------------------------------------------------------ |
147
+ | `kanda` | One of the 7 books (kandas) of the Ramayana (e.g., Bala Kanda, Ayodhya Kanda). |
148
+ | `sarga` | The chapter number within each kanda. |
149
+ | `shloka` | The shloka (verse) number within the sarga. |
150
+ | `shloka_text` | Original Sanskrit verse. |
151
+ | `explanation` | English explanation or interpretation of the shloka. |
152
+
153
+ ### 🔍 **Example**
154
+
155
+ ```text
156
+ kanda: Bala Kanda
157
+ sarga: 1
158
+ shloka: 1
159
+ shloka_text: तपस्स्वाध्यायनिरतं तपस्वी वाग्विदां वरम् ।
160
+ explanation: Ascetic Valmiki enquired of Narada, preeminent among sages, who was engaged in penance and study of the Vedas.
161
+ ```
162
+
163
+ ### 💡 **Insights**
164
+
165
+ * The data is well-structured with nearly **1,400+** records.
166
+ * Each record reflects a deep philosophical or narrative moment from the epic.
167
+ * Metadata (`kanda`, `sarga`, `shloka`) allows precise retrieval and organization.
168
+ * Used for vector indexing and semantic retrieval.
169
+ '''
170
+
171
+ GitaGPT='''
172
+ ## 🕉️ **GitaGPT – Overview and Dataset Summary**
173
+
174
+ ### 📖 **Introduction**
175
+
176
+ **GitaGPT** is a chatbot built to answer spiritual and philosophical questions using the **Bhagavad Gita** as its primary source. It references verses (slokas) directly from the Gita, delivering insights supported by both Sanskrit, Hindi, and English explanations.
177
+
178
+ ### 🗂️ **Dataset Structure**
179
+
180
+ The uploaded Gita dataset contains the following fields:
181
+
182
+ | Column | Description |
183
+ | --------------------- | --------------------------------------------------- |
184
+ | `S.No.` | Serial number of the verse. |
185
+ | `Title` | Title of the chapter (e.g., Arjuna's Vishada Yoga). |
186
+ | `Chapter` | Gita chapter number (e.g., Chapter 1). |
187
+ | `Verse` | Verse ID (e.g., Verse 1.1). |
188
+ | `Sanskrit Anuvad` | Original verse in Devanagari Sanskrit. |
189
+ | `Hindi Anuvad` | Hindi translation/interpretation. |
190
+ | `Enlgish Translation` | English translation/interpretation. |
191
+
192
+ ### 🔍 **Example**
193
+
194
+ ```text
195
+ Chapter: Chapter 1
196
+ Verse: Verse 1.1
197
+ Sanskrit: धृतराष्ट्र उवाच । धर्मक्षेत्रे कुरुक्षेत्रे समवेता युयुत्सवः...
198
+ Hindi: धृतराष्ट्र बोले- हे संजय! धर्मभूमि कुरुक्षेत्र में एकत्र हुए युद्ध की इच्छा रखने वाले...
199
+ English: Dhrtarashtra asked of Sanjaya: O SANJAYA, what did my sons and the sons of Pandu do?
200
+ ```
201
+
202
+ ### 💡 **Insights**
203
+
204
+ * The dataset contains **700+ verses** from all 18 chapters.
205
+ * Multilingual representation (Sanskrit, Hindi, English) enhances usability for diverse users.
206
+ * The verse structure (`Chapter`, `Verse`) aids in precise referencing and response generation.
207
+ * Perfectly suited for semantic search via vector embeddings.
208
+ '''
209
+
210
  footer = """
211
  <div style="background-color: #1d2938; color: white; padding: 10px; width: 100%; bottom: 0; left: 0; display: flex; justify-content: space-between; align-items: center; padding: .2rem 35px; box-sizing: border-box; font-size: 16px;">
212
  <div style="text-align: left;">