Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -4,10 +4,12 @@
|
|
| 4 |
# HuggingFace Spaces application to anlayze uploaded PDF files
|
| 5 |
# with open-source models ( hkunlp/instructor-xl )
|
| 6 |
#
|
| 7 |
-
# Mike Pastor February
|
| 8 |
|
| 9 |
|
| 10 |
import streamlit as st
|
|
|
|
|
|
|
| 11 |
from dotenv import load_dotenv
|
| 12 |
|
| 13 |
from PyPDF2 import PdfReader
|
|
@@ -122,22 +124,22 @@ def process_user_question(user_question):
|
|
| 122 |
st.session_state.chat_history = response['chat_history']
|
| 123 |
|
| 124 |
# st.empty()
|
| 125 |
-
|
| 126 |
|
| 127 |
for i, message in enumerate(st.session_state.chat_history):
|
| 128 |
if i % 2 == 0:
|
| 129 |
st.write(user_template.replace(
|
| 130 |
"{{MSG}}", message.content), unsafe_allow_html=True)
|
| 131 |
|
| 132 |
-
|
| 133 |
|
| 134 |
else:
|
| 135 |
st.write(bot_template.replace(
|
| 136 |
"{{MSG}}", message.content), unsafe_allow_html=True)
|
| 137 |
|
|
|
|
| 138 |
|
| 139 |
|
| 140 |
-
from streamlit.components.v1 import html
|
| 141 |
|
| 142 |
lorem = (
|
| 143 |
"""
|
|
@@ -149,7 +151,7 @@ def process_user_question(user_question):
|
|
| 149 |
)
|
| 150 |
|
| 151 |
# html(lorem, height=100, scrolling=True)
|
| 152 |
-
html(
|
| 153 |
|
| 154 |
|
| 155 |
# with st.container() as scrollable_container:
|
|
|
|
| 4 |
# HuggingFace Spaces application to anlayze uploaded PDF files
|
| 5 |
# with open-source models ( hkunlp/instructor-xl )
|
| 6 |
#
|
| 7 |
+
# Mike Pastor February 16, 2024
|
| 8 |
|
| 9 |
|
| 10 |
import streamlit as st
|
| 11 |
+
from streamlit.components.v1 import html
|
| 12 |
+
|
| 13 |
from dotenv import load_dotenv
|
| 14 |
|
| 15 |
from PyPDF2 import PdfReader
|
|
|
|
| 124 |
st.session_state.chat_history = response['chat_history']
|
| 125 |
|
| 126 |
# st.empty()
|
| 127 |
+
results_string = ""
|
| 128 |
|
| 129 |
for i, message in enumerate(st.session_state.chat_history):
|
| 130 |
if i % 2 == 0:
|
| 131 |
st.write(user_template.replace(
|
| 132 |
"{{MSG}}", message.content), unsafe_allow_html=True)
|
| 133 |
|
| 134 |
+
results_string += ( "<p>" + message.content + "</p>" )
|
| 135 |
|
| 136 |
else:
|
| 137 |
st.write(bot_template.replace(
|
| 138 |
"{{MSG}}", message.content), unsafe_allow_html=True)
|
| 139 |
|
| 140 |
+
results_string += ( "<p>" + message.content + "</p>" )
|
| 141 |
|
| 142 |
|
|
|
|
| 143 |
|
| 144 |
lorem = (
|
| 145 |
"""
|
|
|
|
| 151 |
)
|
| 152 |
|
| 153 |
# html(lorem, height=100, scrolling=True)
|
| 154 |
+
html(results_string, height=100, scrolling=True)
|
| 155 |
|
| 156 |
|
| 157 |
# with st.container() as scrollable_container:
|