Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,10 +9,10 @@ def load_data():
|
|
| 9 |
|
| 10 |
data = load_data()
|
| 11 |
|
| 12 |
-
# Load NLP model for intent detection
|
| 13 |
@st.cache_resource
|
| 14 |
def load_nlp_model():
|
| 15 |
-
return pipeline("
|
| 16 |
|
| 17 |
classifier = load_nlp_model()
|
| 18 |
|
|
@@ -24,7 +24,13 @@ if user_input:
|
|
| 24 |
# Detect intent
|
| 25 |
labels = ["coverage explanation", "plan recommendation"]
|
| 26 |
result = classifier(user_input, candidate_labels=labels)
|
| 27 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 28 |
|
| 29 |
if intent == "coverage explanation":
|
| 30 |
st.subheader("Coverage Details")
|
|
|
|
| 9 |
|
| 10 |
data = load_data()
|
| 11 |
|
| 12 |
+
# Load NLP model for intent detection using DeepSeek
|
| 13 |
@st.cache_resource
|
| 14 |
def load_nlp_model():
|
| 15 |
+
return pipeline("zero-shot-classification", model="deepseek-ai/deepseek-llm-7b-chat")
|
| 16 |
|
| 17 |
classifier = load_nlp_model()
|
| 18 |
|
|
|
|
| 24 |
# Detect intent
|
| 25 |
labels = ["coverage explanation", "plan recommendation"]
|
| 26 |
result = classifier(user_input, candidate_labels=labels)
|
| 27 |
+
|
| 28 |
+
# Check if DeepSeek returns results properly
|
| 29 |
+
if "labels" in result:
|
| 30 |
+
intent = result["labels"][0] # Get the most likely intent
|
| 31 |
+
else:
|
| 32 |
+
st.write("Intent detection failed. Please try again.")
|
| 33 |
+
intent = None
|
| 34 |
|
| 35 |
if intent == "coverage explanation":
|
| 36 |
st.subheader("Coverage Details")
|