Spaces:
Running
Running
Update main.py
Browse files
main.py
CHANGED
@@ -114,12 +114,8 @@ async def analyze(data: ReviewInput, x_api_key: str = Header(None)):
|
|
114 |
sentiment_pipeline = pipeline("sentiment-analysis", model=data.model)
|
115 |
sentiment = sentiment_pipeline(data.text)[0]
|
116 |
|
117 |
-
|
118 |
-
|
119 |
-
emotion_raw[0]["label"]
|
120 |
-
if isinstance(emotion_raw, list) and isinstance(emotion_raw[0], dict)
|
121 |
-
else str(emotion_raw)
|
122 |
-
)
|
123 |
|
124 |
churn_risk = assess_churn_risk(sentiment["label"], emotion)
|
125 |
|
@@ -201,13 +197,8 @@ async def bulk_analyze(data: BulkReviewInput, token: str = Query(None)):
|
|
201 |
summary = smart_summarize(review_text, n_clusters=2 if data.intelligence else 1)
|
202 |
sentiment = sentiment_pipeline(review_text)[0]
|
203 |
|
204 |
-
|
205 |
-
|
206 |
-
emotion = (
|
207 |
-
emotion_raw[0]["label"]
|
208 |
-
if isinstance(emotion_raw, list) and isinstance(emotion_raw[0], dict)
|
209 |
-
else str(emotion_raw)
|
210 |
-
)
|
211 |
|
212 |
churn = assess_churn_risk(sentiment["label"], emotion)
|
213 |
pain = extract_pain_points(review_text) if data.aspects else []
|
|
|
114 |
sentiment_pipeline = pipeline("sentiment-analysis", model=data.model)
|
115 |
sentiment = sentiment_pipeline(data.text)[0]
|
116 |
|
117 |
+
emotion = detect_emotion(data.text)
|
118 |
+
|
|
|
|
|
|
|
|
|
119 |
|
120 |
churn_risk = assess_churn_risk(sentiment["label"], emotion)
|
121 |
|
|
|
197 |
summary = smart_summarize(review_text, n_clusters=2 if data.intelligence else 1)
|
198 |
sentiment = sentiment_pipeline(review_text)[0]
|
199 |
|
200 |
+
emotion = detect_emotion(review_text)
|
201 |
+
|
|
|
|
|
|
|
|
|
|
|
202 |
|
203 |
churn = assess_churn_risk(sentiment["label"], emotion)
|
204 |
pain = extract_pain_points(review_text) if data.aspects else []
|