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
|
| 13 |
@st.cache_resource
|
| 14 |
def load_nlp_model():
|
| 15 |
-
return pipeline("
|
| 16 |
|
| 17 |
classifier = load_nlp_model()
|
| 18 |
|
|
@@ -21,16 +21,17 @@ st.title("Health Insurance Coverage Assistant")
|
|
| 21 |
user_input = st.text_input("Enter your query (e.g., coverage for diabetes, best plans, etc.)")
|
| 22 |
|
| 23 |
if user_input:
|
| 24 |
-
# Detect intent
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
#
|
| 29 |
-
if "
|
| 30 |
-
intent =
|
|
|
|
|
|
|
| 31 |
else:
|
| 32 |
-
|
| 33 |
-
intent = None
|
| 34 |
|
| 35 |
if intent == "coverage explanation":
|
| 36 |
st.subheader("Coverage Details")
|
|
|
|
| 9 |
|
| 10 |
data = load_data()
|
| 11 |
|
| 12 |
+
# Load DeepSeek model (General text classification)
|
| 13 |
@st.cache_resource
|
| 14 |
def load_nlp_model():
|
| 15 |
+
return pipeline("text-classification", model="deepseek-ai/deepseek-llm-7b-chat")
|
| 16 |
|
| 17 |
classifier = load_nlp_model()
|
| 18 |
|
|
|
|
| 21 |
user_input = st.text_input("Enter your query (e.g., coverage for diabetes, best plans, etc.)")
|
| 22 |
|
| 23 |
if user_input:
|
| 24 |
+
# Detect intent using text classification
|
| 25 |
+
result = classifier(user_input)
|
| 26 |
+
label = result[0]["label"] # Get predicted label
|
| 27 |
+
|
| 28 |
+
# Manual mapping (since DeepSeek does not support `candidate_labels`)
|
| 29 |
+
if "coverage" in user_input.lower():
|
| 30 |
+
intent = "coverage explanation"
|
| 31 |
+
elif "recommend" in user_input.lower() or "best plan" in user_input.lower():
|
| 32 |
+
intent = "plan recommendation"
|
| 33 |
else:
|
| 34 |
+
intent = "unknown"
|
|
|
|
| 35 |
|
| 36 |
if intent == "coverage explanation":
|
| 37 |
st.subheader("Coverage Details")
|