Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -100,13 +100,16 @@ def handle_userinput(user_question):
|
|
100 |
# 대화 기록을 저장합니다.
|
101 |
st.session_state.chat_history = response['chat_history']
|
102 |
|
|
|
103 |
for i, message in enumerate(st.session_state.chat_history):
|
104 |
if i % 2 == 0:
|
105 |
-
|
106 |
-
"{{MSG}}", message.content), unsafe_allow_html=True)
|
107 |
else:
|
108 |
-
|
109 |
-
|
|
|
|
|
|
|
110 |
|
111 |
|
112 |
def main():
|
@@ -121,6 +124,11 @@ def main():
|
|
121 |
|
122 |
st.header("Chat with multiple Files :")
|
123 |
user_question = st.text_input("Ask a question about your documents:")
|
|
|
|
|
|
|
|
|
|
|
124 |
if user_question:
|
125 |
handle_userinput(user_question)
|
126 |
|
@@ -131,7 +139,7 @@ def main():
|
|
131 |
|
132 |
st.subheader("Your documents")
|
133 |
docs = st.file_uploader(
|
134 |
-
"Upload your PDFs,
|
135 |
if st.button("Process"):
|
136 |
with st.spinner("Processing"):
|
137 |
# get pdf text
|
|
|
100 |
# 대화 기록을 저장합니다.
|
101 |
st.session_state.chat_history = response['chat_history']
|
102 |
|
103 |
+
chat_output = ""
|
104 |
for i, message in enumerate(st.session_state.chat_history):
|
105 |
if i % 2 == 0:
|
106 |
+
chat_output += user_template.replace("{{MSG}}", message.content) + "\n"
|
|
|
107 |
else:
|
108 |
+
chat_output += bot_template.replace("{{MSG}}", message.content) + "\n"
|
109 |
+
|
110 |
+
# 업데이트된 대화를 표시
|
111 |
+
st.session_state.chat_output = chat_output
|
112 |
+
st.text_area("Chat with the System:", value=chat_output, height=200, max_chars=None, key="chat_output", disabled=True)
|
113 |
|
114 |
|
115 |
def main():
|
|
|
124 |
|
125 |
st.header("Chat with multiple Files :")
|
126 |
user_question = st.text_input("Ask a question about your documents:")
|
127 |
+
|
128 |
+
# 대화창을 표시하는 텍스트 영역
|
129 |
+
st.text_area("Chat with the System:", value="", height=200, max_chars=None, key="chat_output", disabled=True)
|
130 |
+
|
131 |
+
|
132 |
if user_question:
|
133 |
handle_userinput(user_question)
|
134 |
|
|
|
139 |
|
140 |
st.subheader("Your documents")
|
141 |
docs = st.file_uploader(
|
142 |
+
"Upload your PDFs, TEXTfiles, CSVfiles, JSONfiles here and click on 'Process'", accept_multiple_files=True)
|
143 |
if st.button("Process"):
|
144 |
with st.spinner("Processing"):
|
145 |
# get pdf text
|