Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -109,6 +109,7 @@ async def analyze(data: ReviewInput, x_api_key: str = Header(None)):
|
|
109 |
sentiment_pipeline = pipeline("sentiment-analysis", model=data.model)
|
110 |
sentiment = sentiment_pipeline(data.text)[0]
|
111 |
emotion = detect_emotion(data.text)
|
|
|
112 |
|
113 |
industry = detect_industry(data.text) if not data.industry or "auto" in data.industry.lower() else data.industry
|
114 |
product_category = detect_product_category(data.text) if not data.product_category or "auto" in data.product_category.lower() else data.product_category
|
@@ -119,7 +120,8 @@ async def analyze(data: ReviewInput, x_api_key: str = Header(None)):
|
|
119 |
"emotion": emotion,
|
120 |
"product_category": product_category,
|
121 |
"device": "Web",
|
122 |
-
"industry": industry
|
|
|
123 |
}
|
124 |
|
125 |
if data.follow_up:
|
|
|
109 |
sentiment_pipeline = pipeline("sentiment-analysis", model=data.model)
|
110 |
sentiment = sentiment_pipeline(data.text)[0]
|
111 |
emotion = detect_emotion(data.text)
|
112 |
+
churn_risk = assess_churn_risk(sentiment["label"], emotion)
|
113 |
|
114 |
industry = detect_industry(data.text) if not data.industry or "auto" in data.industry.lower() else data.industry
|
115 |
product_category = detect_product_category(data.text) if not data.product_category or "auto" in data.product_category.lower() else data.product_category
|
|
|
120 |
"emotion": emotion,
|
121 |
"product_category": product_category,
|
122 |
"device": "Web",
|
123 |
+
"industry": industry,
|
124 |
+
"churn_risk": churn_risk
|
125 |
}
|
126 |
|
127 |
if data.follow_up:
|