Update app.py
Browse files
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/
|
| 17 |
-
model_name = "model-
|
| 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 %
|
| 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 |
-
|
| 92 |
-
|
| 93 |
|
| 94 |
|
| 95 |
|
| 96 |
-
for
|
| 97 |
-
|
| 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()
|