prasadnu commited on
Commit
9704ba3
·
1 Parent(s): bec259a

colpali fix

Browse files
pages/Multimodal_Conversational_Search.py CHANGED
@@ -279,7 +279,26 @@ def render_answer(question,answer,index,res_img):
279
  with col2:
280
  ans_ = answer['answer']
281
  st.write(ans_)
282
-
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
283
 
284
  colu1,colu2,colu3 = st.columns([4,82,20])
285
  with colu2:
@@ -338,8 +357,8 @@ def render_answer(question,answer,index,res_img):
338
 
339
  rdn_key = ''.join([random.choice(string.ascii_letters)
340
  for _ in range(10)])
341
- rdn_key_1 = ''.join([random.choice(string.ascii_letters)
342
- for _ in range(10)])
343
  currentValue = ''.join(st.session_state.input_rag_searchType)+str(st.session_state.input_is_rerank)+str(st.session_state.input_table_with_sql)+st.session_state.input_index
344
  oldValue = ''.join(st.session_state.inputs_["rag_searchType"])+str(st.session_state.inputs_["is_rerank"])+str(st.session_state.inputs_["table_with_sql"])+str(st.session_state.inputs_["index"])
345
  #print("changing values-----------------")
@@ -370,26 +389,7 @@ def render_answer(question,answer,index,res_img):
370
  pass
371
 
372
  placeholder__ = st.empty()
373
- #with placeholder__.container():
374
- placeholder__.button("Show similarity map",key=rdn_key_1,on_click=handle_input,args=('colpali_show_similarity_map',None))
375
-
376
-
377
- # def show_maxsim():
378
- # st.session_state.show_columns = True
379
- # # st.session_state.input_query = st.session_state.questions_[-1]["question"]
380
- # # st.session_state.answers_.pop()
381
- # # st.session_state.questions_.pop()
382
- # handle_input()
383
- # print("*"*20)
384
- # print(st.session_state.input_query)
385
- # print(st.session_state.answers_)
386
- # print(st.session_state.questions_)
387
- # print("*"*20)
388
- # with placeholder.container():
389
- # render_all()
390
-
391
- #if(st.session_state.input_is_colpali):
392
-
393
  #placeholder__.button("Show similarity map",key=rdn_key_1,on_click = show_maxsim)
394
 
395
 
@@ -546,7 +546,9 @@ with st.sidebar:
546
  #st.session_state.input_query = ""
547
  else:
548
  st.session_state.input_is_colpali = False
549
-
 
 
550
  with st.expander("Sample questions for Colpali retriever:"):
551
  st.write("1. Proportion of female new hires 2021-2023? \n\n 2. First-half 2021 return on unlisted real estate investments? \n\n 3. Trend of the fund's expected absolute volatility between January 2014 and January 2016? \n\n 4. Fund return percentage in 2017? \n\n 5. Annualized gross return of the fund from 1997 to 2008?")
552
 
 
279
  with col2:
280
  ans_ = answer['answer']
281
  st.write(ans_)
282
+ rdn_key_1 = ''.join([random.choice(string.ascii_letters)
283
+ for _ in range(10)])
284
+ # def show_maxsim():
285
+ # st.session_state.show_columns = True
286
+ # # st.session_state.input_query = st.session_state.questions_[-1]["question"]
287
+ # # st.session_state.answers_.pop()
288
+ # # st.session_state.questions_.pop()
289
+ # handle_input()
290
+ # print("*"*20)
291
+ # print(st.session_state.input_query)
292
+ # print(st.session_state.answers_)
293
+ # print(st.session_state.questions_)
294
+ # print("*"*20)
295
+ # with placeholder.container():
296
+ # render_all()
297
+
298
+ # if(st.session_state.input_is_colpali):
299
+ # placeholder__ = st.empty()
300
+ # placeholder__.button("Show similarity map",key=rdn_key_1,on_click=handle_input,args=('colpali_show_similarity_map',None))
301
+
302
 
303
  colu1,colu2,colu3 = st.columns([4,82,20])
304
  with colu2:
 
357
 
358
  rdn_key = ''.join([random.choice(string.ascii_letters)
359
  for _ in range(10)])
360
+ # rdn_key_1 = ''.join([random.choice(string.ascii_letters)
361
+ # for _ in range(10)])
362
  currentValue = ''.join(st.session_state.input_rag_searchType)+str(st.session_state.input_is_rerank)+str(st.session_state.input_table_with_sql)+st.session_state.input_index
363
  oldValue = ''.join(st.session_state.inputs_["rag_searchType"])+str(st.session_state.inputs_["is_rerank"])+str(st.session_state.inputs_["table_with_sql"])+str(st.session_state.inputs_["index"])
364
  #print("changing values-----------------")
 
389
  pass
390
 
391
  placeholder__ = st.empty()
392
+ placeholder__.button("🔄",key=rdn_key,on_click=on_button_click)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
393
  #placeholder__.button("Show similarity map",key=rdn_key_1,on_click = show_maxsim)
394
 
395
 
 
546
  #st.session_state.input_query = ""
547
  else:
548
  st.session_state.input_is_colpali = False
549
+
550
+ st.button("Show similarity map",key="input_sim_map",on_click=handle_input,args=('colpali_show_similarity_map',None))
551
+
552
  with st.expander("Sample questions for Colpali retriever:"):
553
  st.write("1. Proportion of female new hires 2021-2023? \n\n 2. First-half 2021 return on unlisted real estate investments? \n\n 3. Trend of the fund's expected absolute volatility between January 2014 and January 2016? \n\n 4. Fund return percentage in 2017? \n\n 5. Annualized gross return of the fund from 1997 to 2008?")
554