datascientist22 commited on
Commit
198dc13
1 Parent(s): e4b0e31

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
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 without unnecessary headers
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 the response
98
  response = tokenizer.decode(outputs[0], skip_special_tokens=True)
99
- response_clean = response.replace("### Instruction and Input:", "").replace("### Response:", "").strip()
100
 
101
  # Update chat history
102
- st.session_state.chat_history.append((query, response_clean))
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: