Spaces:
Running
on
T4
Running
on
T4
change ksize in RAG
Browse files- RAG/rag_DocumentSearcher.py +12 -12
RAG/rag_DocumentSearcher.py
CHANGED
@@ -307,20 +307,20 @@ def query_(awsauth,inputs, session_id,search_types):
|
|
307 |
for hit in hits[0:5]:
|
308 |
|
309 |
|
310 |
-
if(hit["_source"]["raw_element_type"] == 'table'):
|
311 |
-
|
312 |
-
|
313 |
-
|
314 |
-
|
315 |
-
|
316 |
|
|
|
|
|
|
|
|
|
|
|
317 |
else:
|
318 |
-
|
319 |
-
with open(parent_dirname+'/figures/'+st.session_state.input_index+"/"+hit["_source"]["raw_element_type"].split("_")[1].replace(".jpg","")+"-resized.jpg", "rb") as read_img:
|
320 |
-
input_encoded = base64.b64encode(read_img.read()).decode("utf8")
|
321 |
-
context.append(invoke_models.generate_image_captions_llm(input_encoded,question))
|
322 |
-
else:
|
323 |
-
context.append(hit["_source"]["processed_element"])
|
324 |
|
325 |
if(hit["_source"]["image"]!="None"):
|
326 |
images_2.append({'file':hit["_source"]["image"],'caption':hit["_source"]["processed_element"]})
|
|
|
307 |
for hit in hits[0:5]:
|
308 |
|
309 |
|
310 |
+
# if(hit["_source"]["raw_element_type"] == 'table'):
|
311 |
+
# #print("Need to analyse table")
|
312 |
+
# is_table_in_result = True
|
313 |
+
# table_res = invoke_models.read_from_table(hit["_source"]["table"],question)
|
314 |
+
# df.append({'name':hit["_source"]["table"],'text':hit["_source"]["processed_element"]})
|
315 |
+
# context_tables.append(table_res+"\n\n"+hit["_source"]["processed_element"])
|
316 |
|
317 |
+
# else:
|
318 |
+
if(hit["_source"]["image"]!="None"):
|
319 |
+
with open(parent_dirname+'/figures/'+st.session_state.input_index+"/"+hit["_source"]["raw_element_type"].split("_")[1].replace(".jpg","")+"-resized.jpg", "rb") as read_img:
|
320 |
+
input_encoded = base64.b64encode(read_img.read()).decode("utf8")
|
321 |
+
context.append(invoke_models.generate_image_captions_llm(input_encoded,question))
|
322 |
else:
|
323 |
+
context.append(hit["_source"]["processed_element"])
|
|
|
|
|
|
|
|
|
|
|
324 |
|
325 |
if(hit["_source"]["image"]!="None"):
|
326 |
images_2.append({'file':hit["_source"]["image"],'caption':hit["_source"]["processed_element"]})
|