bainskarman commited on
Commit
5c9c8d3
·
verified ·
1 Parent(s): c502103

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -9
app.py CHANGED
@@ -157,8 +157,7 @@ def main():
157
  st.write(f"**Detected Language:** {language}")
158
 
159
  # Query Translation
160
- if st.button("Apply Query Translation"):
161
- st.write(f"**Applied Query Translation Method:** {query_translation}")
162
  # Format the system prompt with the user's question
163
  formatted_prompt = system_prompt.format(question=prompt)
164
  st.write("**Formatted System Prompt:**", formatted_prompt)
@@ -219,15 +218,12 @@ def main():
219
  # Generate response based on PDF content
220
  pdf_context = "\n".join([result["content"] for result in search_results])
221
  response = query_huggingface_model(f"Based on the following context:\n{pdf_context}\n\nAnswer this question: {prompt}", max_new_tokens, temperature, top_k)
 
 
222
  else:
223
- st.write("**No relevant content found in the PDF. Generating response without PDF context.**")
224
- response = query_huggingface_model(prompt, max_new_tokens, temperature, top_k)
225
  else:
226
- st.write("**No PDF uploaded. Generating response without PDF context.**")
227
- response = query_huggingface_model(prompt, max_new_tokens, temperature, top_k)
228
-
229
- if response:
230
- st.write("**Response:**", response)
231
 
232
  if __name__ == "__main__":
233
  main()
 
157
  st.write(f"**Detected Language:** {language}")
158
 
159
  # Query Translation
160
+ if st.button("Apply Query Translation"):
 
161
  # Format the system prompt with the user's question
162
  formatted_prompt = system_prompt.format(question=prompt)
163
  st.write("**Formatted System Prompt:**", formatted_prompt)
 
218
  # Generate response based on PDF content
219
  pdf_context = "\n".join([result["content"] for result in search_results])
220
  response = query_huggingface_model(f"Based on the following context:\n{pdf_context}\n\nAnswer this question: {prompt}", max_new_tokens, temperature, top_k)
221
+ if response:
222
+ st.write("**Response:**", response)
223
  else:
224
+ st.write("**No relevant content found in the PDF. No response generated.**")
 
225
  else:
226
+ st.write("**No PDF uploaded. No response generated.**")
 
 
 
 
227
 
228
  if __name__ == "__main__":
229
  main()