Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -114,7 +114,10 @@ def query(category, text):
|
|
114 |
1. Construct a prompt
|
115 |
2. Generate a response
|
116 |
"""
|
117 |
-
|
|
|
|
|
|
|
118 |
chain = categories.category_modules[category].chain
|
119 |
formatted_prompt = chain.prompt.format_prompt(
|
120 |
text=text,
|
|
|
114 |
1. Construct a prompt
|
115 |
2. Generate a response
|
116 |
"""
|
117 |
+
try:
|
118 |
+
category = Category[category]
|
119 |
+
except KeyError:
|
120 |
+
return [{"error": f"Invalid category: {category}"}]
|
121 |
chain = categories.category_modules[category].chain
|
122 |
formatted_prompt = chain.prompt.format_prompt(
|
123 |
text=text,
|