Spaces:
Runtime error
Runtime error
NCTCMumbai
commited on
Commit
•
1e6bb68
1
Parent(s):
f4d1676
Update app.py
Browse files
app.py
CHANGED
@@ -102,7 +102,7 @@ def bot(history, cross_encoder):
|
|
102 |
|
103 |
# if COLBERT RAGATATOUILLE PROCEDURE :
|
104 |
if cross_encoder=='ColBERT':
|
105 |
-
gr.Warning('Retrieving using ColBERT')
|
106 |
RAG= RAGPretrainedModel.from_pretrained("colbert-ir/colbertv2.0")
|
107 |
RAG_db=RAG.from_index('.ragatouille/colbert/indexes/mockingbird')
|
108 |
documents_full=RAG_db.search(query,k=top_k_rank)
|
@@ -168,14 +168,15 @@ with gr.Blocks(theme='Insuz/SimpleIndigo') as demo:
|
|
168 |
<h1 style="color: #008000">NIRVACHANA - <span style="color: #008000">Expenditure Observer AI Assistant</span></h1>
|
169 |
<img src='logo.png' alt="Chatbot" width="50" height="50" />
|
170 |
</div>""",elem_id='heading')
|
171 |
-
gr.HTML(value="""<p style="font-family: sans-serif; font-size: 16px;">A free chat bot assistant for Expenditure Observers on Compendium on Election Expenditure Monitoring using Open source LLMs. <br> The bot can answer questions in natural language, taking relevant extracts from the ECI document which can be accessed <a href="https://www.eci.gov.in/eci-backend/public/api/download?url=LMAhAK6sOPBp%2FNFF0iRfXbEB1EVSLT41NNLRjYNJJP1KivrUxbfqkDatmHy12e%2Fzk1vx4ptJpQsKYHA87guoLjnPUWtHeZgKtEqs%2FyzfTTYIC0newOHHOjl1rl0u3mJBSIq%2Fi7zDsrcP74v%2FKr8UNw%3D%3D" style="color: #FF0000; text-decoration: none;"></a
|
172 |
usage_count = get_and_increment_value_count(db,collection_name, field_name)
|
173 |
count_html =gr.HTML(value= f"""
|
174 |
<div style="display: flex; justify-content: flex-end;">
|
175 |
-
<span style="font-weight: bold; color: maroon;">No of Usages:</span> {usage_count}
|
176 |
</div>
|
177 |
""")
|
178 |
-
|
|
|
179 |
chatbot = gr.Chatbot(
|
180 |
[],
|
181 |
elem_id="chatbot",
|
@@ -195,7 +196,7 @@ with gr.Blocks(theme='Insuz/SimpleIndigo') as demo:
|
|
195 |
)
|
196 |
txt_btn = gr.Button(value="Submit text", scale=1)
|
197 |
|
198 |
-
cross_encoder = gr.Radio(choices=['MiniLM-L6v2','BGE reranker','ColBERT'], value='BGE reranker',label="Embeddings", info="Choose MiniLM for Speed, BGE reranker for accuracy,ColBERT for both")
|
199 |
|
200 |
prompt_html = gr.HTML()
|
201 |
# Turn off interactivity while generating if you click
|
|
|
102 |
|
103 |
# if COLBERT RAGATATOUILLE PROCEDURE :
|
104 |
if cross_encoder=='ColBERT':
|
105 |
+
gr.Warning('Retrieving using ColBERT.. First time query will take a minute for model to load..pls wait')
|
106 |
RAG= RAGPretrainedModel.from_pretrained("colbert-ir/colbertv2.0")
|
107 |
RAG_db=RAG.from_index('.ragatouille/colbert/indexes/mockingbird')
|
108 |
documents_full=RAG_db.search(query,k=top_k_rank)
|
|
|
168 |
<h1 style="color: #008000">NIRVACHANA - <span style="color: #008000">Expenditure Observer AI Assistant</span></h1>
|
169 |
<img src='logo.png' alt="Chatbot" width="50" height="50" />
|
170 |
</div>""",elem_id='heading')
|
171 |
+
gr.HTML(value="""<p style="font-family: sans-serif; font-size: 16px;">A free chat bot assistant for Expenditure Observers on Compendium on Election Expenditure Monitoring using Open source LLMs. <br> The bot can answer questions in natural language, taking relevant extracts from the ECI document which can be accessed <a href="https://www.eci.gov.in/eci-backend/public/api/download?url=LMAhAK6sOPBp%2FNFF0iRfXbEB1EVSLT41NNLRjYNJJP1KivrUxbfqkDatmHy12e%2Fzk1vx4ptJpQsKYHA87guoLjnPUWtHeZgKtEqs%2FyzfTTYIC0newOHHOjl1rl0u3mJBSIq%2Fi7zDsrcP74v%2FKr8UNw%3D%3D" style="color: #FF0000; text-decoration: none;"></a>CLICK HERE ! </p>""",elem_id='Sub-heading')
|
172 |
usage_count = get_and_increment_value_count(db,collection_name, field_name)
|
173 |
count_html =gr.HTML(value= f"""
|
174 |
<div style="display: flex; justify-content: flex-end;">
|
175 |
+
<span style="font-weight: bold; color: maroon; font-size: 18px;">No of Usages:</span> {usage_count}
|
176 |
</div>
|
177 |
""")
|
178 |
+
gr.HTML(value=f"""<p style="font-family: Arial, sans-serif; font-size: 16px;">Developed by Ramesh M IRS (C& CE), Suggestions may be sent to <a href="mailto:[email protected]" style="color: #00008B; font-style: italic;">[email protected]</a>.</p>
|
179 |
+
""", elem_id='Sub-heading1 ')
|
180 |
chatbot = gr.Chatbot(
|
181 |
[],
|
182 |
elem_id="chatbot",
|
|
|
196 |
)
|
197 |
txt_btn = gr.Button(value="Submit text", scale=1)
|
198 |
|
199 |
+
cross_encoder = gr.Radio(choices=['MiniLM-L6v2','BGE reranker','ColBERT'], value='BGE reranker',label="Embeddings", info="Choose MiniLM for Speed, BGE reranker for accuracy,ColBERT for both (First query to Colbert may take litte time)")
|
200 |
|
201 |
prompt_html = gr.HTML()
|
202 |
# Turn off interactivity while generating if you click
|