muhammadahmedrayyan commited on
Commit
05b3276
1 Parent(s): 89c8c60

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -3
app.py CHANGED
@@ -143,9 +143,9 @@ with col2:
143
  if search_input:
144
  with st.spinner("Generating response..."):
145
  try:
146
- if model_selection == "Disease Management":
147
  pipe = create_pipeline("harishussain12/Disease_Managment")
148
-
149
  context = ""
150
  if uploaded_file is not None:
151
  file_content = read_pdf(uploaded_file)
@@ -155,6 +155,8 @@ with col2:
155
  context = file_content
156
 
157
  query_input = search_input + (f"\n\nContext:\n{context}" if context else "")
 
 
158
  response = pipe(query_input, max_length=200, num_return_sequences=1)
159
  st.markdown(f"### Response:\n{response[0]['generated_text']}")
160
 
@@ -174,4 +176,4 @@ with col2:
174
  st.markdown(f"### Answer:\n{result['answer']}")
175
 
176
  except Exception as e:
177
- st.error(f"Error generating response: {str(e)}")
 
143
  if search_input:
144
  with st.spinner("Generating response..."):
145
  try:
146
+ if model_selection == "Disease Analysis":
147
  pipe = create_pipeline("harishussain12/Disease_Managment")
148
+
149
  context = ""
150
  if uploaded_file is not None:
151
  file_content = read_pdf(uploaded_file)
 
155
  context = file_content
156
 
157
  query_input = search_input + (f"\n\nContext:\n{context}" if context else "")
158
+ st.write("Debug: Query Input:", query_input) # Debugging
159
+
160
  response = pipe(query_input, max_length=200, num_return_sequences=1)
161
  st.markdown(f"### Response:\n{response[0]['generated_text']}")
162
 
 
176
  st.markdown(f"### Answer:\n{result['answer']}")
177
 
178
  except Exception as e:
179
+ st.error(f"Error generating response: {str(e)}")