Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -47,7 +47,10 @@ def analyze_reviews(uploaded_file):
|
|
| 47 |
for complaint in complaint_texts:
|
| 48 |
try:
|
| 49 |
# Summarize each complaint text
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
| 51 |
# Classify the summary into predefined topics
|
| 52 |
topic_result = zero_classifier(summary_piece, ["Driver Issue", "App Issue", "Payment Issue", "Customer Support", "Wait Time"])
|
| 53 |
top_topic = topic_result["labels"][0]
|
|
|
|
| 47 |
for complaint in complaint_texts:
|
| 48 |
try:
|
| 49 |
# Summarize each complaint text
|
| 50 |
+
if len(tokenizer(complaint)["input_ids"]) < 15:
|
| 51 |
+
summary = complaint # skip summary
|
| 52 |
+
else:
|
| 53 |
+
summary_piece = problem_extractor(complaint, max_length=40, min_length=15, do_sample=False)[0]["summary_text"]
|
| 54 |
# Classify the summary into predefined topics
|
| 55 |
topic_result = zero_classifier(summary_piece, ["Driver Issue", "App Issue", "Payment Issue", "Customer Support", "Wait Time"])
|
| 56 |
top_topic = topic_result["labels"][0]
|