Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -5,8 +5,8 @@ import re
|
|
5 |
# Load Arabic NLP model for intent classification
|
6 |
intent_classifier_ar = pipeline("text-classification", model="aubmindlab/bert-base-arabertv02")
|
7 |
|
8 |
-
# Load English NLP model for
|
9 |
-
intent_classifier_en = pipeline("
|
10 |
|
11 |
# Load language detection model
|
12 |
language_detector = pipeline("text-classification", model="papluca/xlm-roberta-base-language-detection")
|
@@ -63,7 +63,7 @@ def classify_intent(message: str, language: str):
|
|
63 |
result = intent_classifier_ar(message)
|
64 |
intent = result[0]['label']
|
65 |
else:
|
66 |
-
# For English
|
67 |
result = intent_classifier_en(message, candidate_labels=list(INTENT_KEYWORDS.keys()))
|
68 |
intent = result["labels"][0]
|
69 |
|
|
|
5 |
# Load Arabic NLP model for intent classification
|
6 |
intent_classifier_ar = pipeline("text-classification", model="aubmindlab/bert-base-arabertv02")
|
7 |
|
8 |
+
# Load English NLP model for zero-shot classification
|
9 |
+
intent_classifier_en = pipeline("zero-shot-classification", model="facebook/bart-large-mnli")
|
10 |
|
11 |
# Load language detection model
|
12 |
language_detector = pipeline("text-classification", model="papluca/xlm-roberta-base-language-detection")
|
|
|
63 |
result = intent_classifier_ar(message)
|
64 |
intent = result[0]['label']
|
65 |
else:
|
66 |
+
# For English - using zero-shot classification correctly
|
67 |
result = intent_classifier_en(message, candidate_labels=list(INTENT_KEYWORDS.keys()))
|
68 |
intent = result["labels"][0]
|
69 |
|