prasadnu commited on
Commit
da86235
·
1 Parent(s): bf1dfe7

rerank model

Browse files
RAG/bedrock_agent.py CHANGED
@@ -6,7 +6,6 @@ from io import BytesIO
6
  import uuid
7
  import pprint
8
  import logging
9
- print(boto3.__version__)
10
  from PIL import Image
11
  import os
12
  import base64
 
6
  import uuid
7
  import pprint
8
  import logging
 
9
  from PIL import Image
10
  import os
11
  import base64
pages/Multimodal_Conversational_Search.py CHANGED
@@ -185,15 +185,17 @@ def handle_input():
185
 
186
 
187
  def write_user_message(md):
188
- col1, col2 = st.columns([3,97])
189
-
190
- with col1:
191
- st.image(USER_ICON, use_column_width='always')
192
- with col2:
193
- #st.warning(md['question'])
 
 
194
 
195
- st.markdown("<div style='color:#e28743';font-size:18px;padding:3px 7px 3px 7px;borderWidth: 0px;borderColor: red;borderStyle: solid;width: fit-content;height: fit-content;border-radius: 10px;font-style: italic;'>"+md['question']+"</div>", unsafe_allow_html = True)
196
-
197
 
198
 
199
  def render_answer(question,answer,index,res_img):
@@ -280,31 +282,31 @@ def render_answer(question,answer,index,res_img):
280
  st.write(answer["source"])
281
 
282
 
283
- with col_3:
284
- if(index == len(st.session_state.questions_)):
285
-
286
- rdn_key = ''.join([random.choice(string.ascii_letters)
287
- for _ in range(10)])
288
- 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
289
- 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"])
290
- def on_button_click():
291
- if(currentValue!=oldValue or 1==1):
292
- st.session_state.input_query = st.session_state.questions_[-1]["question"]
293
- st.session_state.answers_.pop()
294
- st.session_state.questions_.pop()
295
 
296
- handle_input()
297
- with placeholder.container():
298
- render_all()
299
- if("currentValue" in st.session_state):
300
- del st.session_state["currentValue"]
301
-
302
- try:
303
- del regenerate
304
- except:
305
- pass
306
- placeholder__ = st.empty()
307
- placeholder__.button("🔄",key=rdn_key,on_click=on_button_click)
308
 
309
 
310
  #Each answer will have context of the question asked in order to associate the provided feedback with the respective question
@@ -335,7 +337,7 @@ with placeholder.container():
335
  st.markdown("")
336
  col_2, col_3 = st.columns([75, 20])
337
  with col_2:
338
- st.text_input("Ask here", key="input_query", label_visibility="collapsed")
339
  with col_3:
340
  play = st.button("Go",on_click=handle_input, key="play")
341
 
 
185
 
186
 
187
  def write_user_message(md):
188
+ placeholder = st.empty()
189
+ with placeholder.container():
190
+ col1, col2 = st.columns([3,97])
191
+
192
+ with col1:
193
+ st.image(USER_ICON, use_column_width='always')
194
+ with col2:
195
+ #st.warning(md['question'])
196
 
197
+ st.markdown("<div style='color:#e28743';font-size:18px;padding:3px 7px 3px 7px;borderWidth: 0px;borderColor: red;borderStyle: solid;width: fit-content;height: fit-content;border-radius: 10px;font-style: italic;'>"+md['question']+"</div>", unsafe_allow_html = True)
198
+
199
 
200
 
201
  def render_answer(question,answer,index,res_img):
 
282
  st.write(answer["source"])
283
 
284
 
285
+ # with col_3:
286
+ # if(index == len(st.session_state.questions_)):
287
+
288
+ # rdn_key = ''.join([random.choice(string.ascii_letters)
289
+ # for _ in range(10)])
290
+ # 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
291
+ # 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"])
292
+ # def on_button_click():
293
+ # if(currentValue!=oldValue or 1==1):
294
+ # st.session_state.input_query = st.session_state.questions_[-1]["question"]
295
+ # st.session_state.answers_.pop()
296
+ # st.session_state.questions_.pop()
297
 
298
+ # handle_input()
299
+ # with placeholder.container():
300
+ # render_all()
301
+ # if("currentValue" in st.session_state):
302
+ # del st.session_state["currentValue"]
303
+
304
+ # try:
305
+ # del regenerate
306
+ # except:
307
+ # pass
308
+ # placeholder__ = st.empty()
309
+ # placeholder__.button("🔄",key=rdn_key,on_click=on_button_click)
310
 
311
 
312
  #Each answer will have context of the question asked in order to associate the provided feedback with the respective question
 
337
  st.markdown("")
338
  col_2, col_3 = st.columns([75, 20])
339
  with col_2:
340
+ input = st.text_input("Ask here", key="input_query", label_visibility="collapsed")
341
  with col_3:
342
  play = st.button("Go",on_click=handle_input, key="play")
343