LeedsLibraries commited on
Commit
6278e8c
·
verified ·
1 Parent(s): 185498f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -1
app.py CHANGED
@@ -885,7 +885,12 @@ def generate_response_from_model(prompt, relevant_docs=None):
885
  raw_response = tokenizer.decode(outputs[0][input_length:], skip_special_tokens=True)
886
  return raw_response.strip()
887
  except Exception as e:
888
- return "Error generating response."
 
 
 
 
 
889
 
890
  def is_conversational_input(prompt):
891
  """Check if input is conversational."""
 
885
  raw_response = tokenizer.decode(outputs[0][input_length:], skip_special_tokens=True)
886
  return raw_response.strip()
887
  except Exception as e:
888
+ error_msg = f"Error generating response: {str(e)}"
889
+ st.error(error_msg) # Show error in UI
890
+ print(f"Model error: {str(e)}") # Log to console
891
+ import traceback
892
+ traceback.print_exc() # Print full stack trace
893
+ return error_msg
894
 
895
  def is_conversational_input(prompt):
896
  """Check if input is conversational."""