Spaces:
Sleeping
Sleeping
user
commited on
Commit
·
b024377
1
Parent(s):
a4614bf
Fix response generation and add error handling
Browse files- app.py +2 -0
- embeddings.npy +0 -0
app.py
CHANGED
@@ -124,6 +124,8 @@ if prompt := st.chat_input("What would you like to ask the Muse?"):
|
|
124 |
with st.spinner("The Muse is contemplating..."):
|
125 |
try:
|
126 |
response = generate_response(prompt, tokenizer, generation_model, embedding_model, index, chunks)
|
|
|
|
|
127 |
except Exception as e:
|
128 |
response = f"I apologize, but I encountered an error: {str(e)}"
|
129 |
|
|
|
124 |
with st.spinner("The Muse is contemplating..."):
|
125 |
try:
|
126 |
response = generate_response(prompt, tokenizer, generation_model, embedding_model, index, chunks)
|
127 |
+
if not response or response.isspace():
|
128 |
+
raise ValueError("Generated response is empty or contains only whitespace")
|
129 |
except Exception as e:
|
130 |
response = f"I apologize, but I encountered an error: {str(e)}"
|
131 |
|
embeddings.npy
ADDED
File without changes
|