Spaces:
Sleeping
Sleeping
datascientist22
commited on
Commit
•
198dc13
1
Parent(s):
e4b0e31
Update app.py
Browse files
app.py
CHANGED
@@ -73,7 +73,7 @@ if submit_button and query:
|
|
73 |
if uploaded_files:
|
74 |
pdf_text = extract_text_from_pdfs(uploaded_files)
|
75 |
|
76 |
-
# Prepare the input prompt
|
77 |
prompt = f"""
|
78 |
Based on the following context/document:
|
79 |
{pdf_text}
|
@@ -94,12 +94,12 @@ if submit_button and query:
|
|
94 |
no_repeat_ngram_size=5,
|
95 |
)
|
96 |
|
97 |
-
# Decode and clean
|
98 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
99 |
-
|
100 |
|
101 |
# Update chat history
|
102 |
-
st.session_state.chat_history.append((query,
|
103 |
|
104 |
# Display chat history
|
105 |
if st.session_state.chat_history:
|
|
|
73 |
if uploaded_files:
|
74 |
pdf_text = extract_text_from_pdfs(uploaded_files)
|
75 |
|
76 |
+
# Prepare the input prompt
|
77 |
prompt = f"""
|
78 |
Based on the following context/document:
|
79 |
{pdf_text}
|
|
|
94 |
no_repeat_ngram_size=5,
|
95 |
)
|
96 |
|
97 |
+
# Decode the response and clean it
|
98 |
response = tokenizer.decode(outputs[0], skip_special_tokens=True)
|
99 |
+
clean_response = response.strip()
|
100 |
|
101 |
# Update chat history
|
102 |
+
st.session_state.chat_history.append((query, clean_response))
|
103 |
|
104 |
# Display chat history
|
105 |
if st.session_state.chat_history:
|