NCTCMumbai commited on
Commit
f2893a3
1 Parent(s): 1f57b49

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -152,7 +152,7 @@ def bot(history, cross_encoder):
152
  query_doc_pair = [[query, doc] for doc in documents]
153
  if cross_encoder=='(FAST) MiniLM-L6v2' :
154
  cross_encoder1 = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')
155
- elif cross_encoder=='(ACCURATE) BGE reranker':
156
  cross_encoder1 = CrossEncoder('BAAI/bge-reranker-base')
157
 
158
  cross_scores = cross_encoder1.predict(query_doc_pair)
@@ -184,11 +184,14 @@ with gr.Blocks(theme='Insuz/SimpleIndigo') as demo:
184
  <h1 style="color: #008000">NIRVACHANA - <span style="color: #008000">Expenditure Observer AI Assistant</span></h1>
185
  <img src='logo.png' alt="Chatbot" width="50" height="50" />
186
  </div>""",elem_id='heading')
187
- gr.HTML(value=f"""
188
  <p style="font-family: sans-serif; font-size: 16px;">
189
  A free chat bot assistant for Expenditure Observers on Compendium on Election Expenditure Monitoring using Open source LLMs. <br>
190
  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: #00008B; text-decoration: none;">CLICK HERE !</a>.
191
  </p>
 
 
 
192
  """, elem_id='Sub-heading')
193
  usage_count = get_and_increment_value_count(db,collection_name, field_name)
194
  gr.HTML(value=f"""<p style="font-family: Arial, sans-serif; font-size: 16px;">Developed by Ramesh M IRS (C& CE) (R-19187), Suggestions may be sent to <a href="mailto:mramesh.irs@gov.in" style="color: #00008B; font-style: italic;">mramesh.irs@gov.in</a>.</p>""", elem_id='Sub-heading1 ')
@@ -218,7 +221,7 @@ with gr.Blocks(theme='Insuz/SimpleIndigo') as demo:
218
  )
219
  txt_btn = gr.Button(value="Submit text", scale=1)
220
 
221
- cross_encoder = gr.Radio(choices=['(FAST) MiniLM-L6v2','(ACCURATE) BGE reranker','(HIGH ACCURATE) ColBERT'], value='(ACCURATE) BGE reranker',label="Embeddings", info="Only First query to Colbert may take litte time)")
222
 
223
  prompt_html = gr.HTML()
224
  # Turn off interactivity while generating if you click
 
152
  query_doc_pair = [[query, doc] for doc in documents]
153
  if cross_encoder=='(FAST) MiniLM-L6v2' :
154
  cross_encoder1 = CrossEncoder('cross-encoder/ms-marco-MiniLM-L-6-v2')
155
+ elif cross_encoder=='(FAIRLY ACCURATE) BGE reranker':
156
  cross_encoder1 = CrossEncoder('BAAI/bge-reranker-base')
157
 
158
  cross_scores = cross_encoder1.predict(query_doc_pair)
 
184
  <h1 style="color: #008000">NIRVACHANA - <span style="color: #008000">Expenditure Observer AI Assistant</span></h1>
185
  <img src='logo.png' alt="Chatbot" width="50" height="50" />
186
  </div>""",elem_id='heading')
187
+ gr.HTML(value=f"""
188
  <p style="font-family: sans-serif; font-size: 16px;">
189
  A free chat bot assistant for Expenditure Observers on Compendium on Election Expenditure Monitoring using Open source LLMs. <br>
190
  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: #00008B; text-decoration: none;">CLICK HERE !</a>.
191
  </p>
192
+ <p style="font-family: sans-serif; font-size: 14px; color: #808080;">
193
+ Disclaimer: This is an independent initiative and AI responses are guidance in nature. It is advised to reconfirm with the latest ECI circulars/instructions.
194
+ </p>
195
  """, elem_id='Sub-heading')
196
  usage_count = get_and_increment_value_count(db,collection_name, field_name)
197
  gr.HTML(value=f"""<p style="font-family: Arial, sans-serif; font-size: 16px;">Developed by Ramesh M IRS (C& CE) (R-19187), Suggestions may be sent to <a href="mailto:mramesh.irs@gov.in" style="color: #00008B; font-style: italic;">mramesh.irs@gov.in</a>.</p>""", elem_id='Sub-heading1 ')
 
221
  )
222
  txt_btn = gr.Button(value="Submit text", scale=1)
223
 
224
+ cross_encoder = gr.Radio(choices=['(FAST) MiniLM-L6v2','(FAIRLY ACCURATE) BGE reranker','(HIGH ACCURATE) ColBERT'], value='(FAIRLY ACCURATE) BGE reranker',label="Embeddings", info="Only First query to Colbert may take litte time)")
225
 
226
  prompt_html = gr.HTML()
227
  # Turn off interactivity while generating if you click