Spaces:
Running
on
T4
Running
on
T4
colpali fix
Browse files
RAG/colpali.py
CHANGED
@@ -250,10 +250,11 @@ def colpali_search_rerank(query):
|
|
250 |
print("show columns activated------------------------")
|
251 |
st.session_state.maxSimImages = img_highlight(st.session_state.top_img, st.session_state.query_token_vectors, st.session_state.query_tokens)
|
252 |
st.session_state.show_columns = False
|
|
|
253 |
st.session_state.input_query = st.session_state.questions_[-1]["question"]
|
254 |
st.session_state.answers_.pop()
|
255 |
st.session_state.questions_.pop()
|
256 |
-
return
|
257 |
# Convert to JSON string
|
258 |
payload = {
|
259 |
"queries": [query]
|
|
|
250 |
print("show columns activated------------------------")
|
251 |
st.session_state.maxSimImages = img_highlight(st.session_state.top_img, st.session_state.query_token_vectors, st.session_state.query_tokens)
|
252 |
st.session_state.show_columns = False
|
253 |
+
return_val = {'text':st.session_state.answers_[0]['answer'],'source':st.session_state.answers_[0]['source'],'image':st.session_state.maxSimImages,'table':[]}
|
254 |
st.session_state.input_query = st.session_state.questions_[-1]["question"]
|
255 |
st.session_state.answers_.pop()
|
256 |
st.session_state.questions_.pop()
|
257 |
+
return return_val
|
258 |
# Convert to JSON string
|
259 |
payload = {
|
260 |
"queries": [query]
|
pages/Multimodal_Conversational_Search.py
CHANGED
@@ -295,10 +295,11 @@ def render_answer(question,answer,index,res_img):
|
|
295 |
# with placeholder.container():
|
296 |
# render_all()
|
297 |
|
298 |
-
|
299 |
-
|
300 |
-
|
301 |
-
|
|
|
302 |
|
303 |
colu1,colu2,colu3 = st.columns([4,82,20])
|
304 |
with colu2:
|
@@ -547,7 +548,7 @@ with st.sidebar:
|
|
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',True))
|
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?")
|
|
|
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',True))
|
301 |
+
with placeholder.container():
|
302 |
+
render_all()
|
303 |
|
304 |
colu1,colu2,colu3 = st.columns([4,82,20])
|
305 |
with colu2:
|
|
|
548 |
else:
|
549 |
st.session_state.input_is_colpali = False
|
550 |
|
551 |
+
#st.button("Show similarity map",key="input_sim_map",on_click=handle_input,args=('colpali_show_similarity_map',True))
|
552 |
|
553 |
with st.expander("Sample questions for Colpali retriever:"):
|
554 |
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?")
|