valeriylo commited on
Commit
b9e42d9
1 Parent(s): acd9548

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -13,8 +13,8 @@ from huggingface_hub import snapshot_download, hf_hub_download
13
 
14
  # from prompts import CONDENSE_QUESTION_PROMPT
15
 
16
- repo_name = "IlyaGusev/saiga2_7b_gguf"
17
- model_name = "model-q2_K.gguf"
18
 
19
  #snapshot_download(repo_id=repo_name, local_dir=".", allow_patterns=model_name)
20
 
@@ -81,22 +81,22 @@ def handle_userinput(user_question):
81
 
82
  st.session_state.retrieved_text = response['source_documents']
83
 
84
- for i, message in enumerate(st.session_state.chat_history):
85
- if i % 2 == 0:
86
  st.write(user_template.replace(
87
  "{{MSG}}", message.content), unsafe_allow_html=True)
88
  else:
89
  st.write(bot_template.replace(
90
  "{{MSG}}", message.content), unsafe_allow_html=True)
91
- #st.write(bot_template.replace(
92
- # "{{MSG}}", str(text[0])), unsafe_allow_html=True)
93
 
94
 
95
 
96
- for n in enumerate(st.session_state.retrieved_text):
97
- st.write(response['source_documents'][n])
98
 
99
- print(response['source_documents'][0])
100
 
101
  # main code
102
  load_dotenv()
 
13
 
14
  # from prompts import CONDENSE_QUESTION_PROMPT
15
 
16
+ repo_name = "IlyaGusev/saiga_mistral_7b_gguf"
17
+ model_name = "model-q4_K.gguf"
18
 
19
  #snapshot_download(repo_id=repo_name, local_dir=".", allow_patterns=model_name)
20
 
 
81
 
82
  st.session_state.retrieved_text = response['source_documents']
83
 
84
+ for i, (message, text) in enumerate(zip(st.session_state.chat_history, st.session_state.retrieved_text)):
85
+ if i % 3 == 0:
86
  st.write(user_template.replace(
87
  "{{MSG}}", message.content), unsafe_allow_html=True)
88
  else:
89
  st.write(bot_template.replace(
90
  "{{MSG}}", message.content), unsafe_allow_html=True)
91
+ st.write(bot_template.replace(
92
+ "{{MSG}}", str(text[1].page_content])), unsafe_allow_html=True)
93
 
94
 
95
 
96
+ #for text in enumerate(st.session_state.retrieved_text):
97
+ # st.write(text[1].page_content, '\n')
98
 
99
+ #print(response['source_documents'][0])
100
 
101
  # main code
102
  load_dotenv()