Spaces:
Sleeping
Sleeping
Update main.py
Browse files
main.py
CHANGED
|
@@ -31,7 +31,7 @@ def predict_single_review(text_rating: TextRatingRequest):
|
|
| 31 |
# spans = [{'label': text, 'color': '', 'value': '', 'sentiment': '', 'score': ''}]
|
| 32 |
# has_sentiments = False
|
| 33 |
# processed_data['spans'] = spans
|
| 34 |
-
processed_data = process_single_comment(raw_data)
|
| 35 |
end_time = time.time()
|
| 36 |
print(f"Time taken to process the data : {end_time - start_time} seconds")
|
| 37 |
return {"processed_data": processed_data, "has_sentiments":has_sentiments}
|
|
@@ -44,8 +44,8 @@ def predict_all_reviews(reviews: AllTextRatingRequest):
|
|
| 44 |
start_time = time.time()
|
| 45 |
for review in reviews:
|
| 46 |
raw_data = {"text":review.get("text", str()), "star_rating":review.get('star_rating', 1), "skip":skip}
|
| 47 |
-
processed_data = process_single_comment(raw_data)
|
| 48 |
-
porcessed_data_list.append(processed_data)
|
| 49 |
end_time = time.time()
|
| 50 |
print(f"Time taken to process the data : {end_time - start_time} seconds")
|
| 51 |
return processed_data_list
|
|
|
|
| 31 |
# spans = [{'label': text, 'color': '', 'value': '', 'sentiment': '', 'score': ''}]
|
| 32 |
# has_sentiments = False
|
| 33 |
# processed_data['spans'] = spans
|
| 34 |
+
processed_data, has_sentiments = process_single_comment(raw_data)
|
| 35 |
end_time = time.time()
|
| 36 |
print(f"Time taken to process the data : {end_time - start_time} seconds")
|
| 37 |
return {"processed_data": processed_data, "has_sentiments":has_sentiments}
|
|
|
|
| 44 |
start_time = time.time()
|
| 45 |
for review in reviews:
|
| 46 |
raw_data = {"text":review.get("text", str()), "star_rating":review.get('star_rating', 1), "skip":skip}
|
| 47 |
+
processed_data, has_sentiments = process_single_comment(raw_data)
|
| 48 |
+
porcessed_data_list.append({"processed_data":processed_data, "has_sentiments":has_sentiments})
|
| 49 |
end_time = time.time()
|
| 50 |
print(f"Time taken to process the data : {end_time - start_time} seconds")
|
| 51 |
return processed_data_list
|