Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -100,6 +100,7 @@ def process_comments(ACCESS_TOKEN):
|
|
100 |
log_message(f"ID страницы: {page_id}")
|
101 |
|
102 |
processed_posts = []
|
|
|
103 |
|
104 |
for post_data in posts_with_unanswered_comments:
|
105 |
post_id = post_data['post_id']
|
@@ -109,6 +110,12 @@ def process_comments(ACCESS_TOKEN):
|
|
109 |
post_replies = []
|
110 |
|
111 |
for comment in unanswered_comments:
|
|
|
|
|
|
|
|
|
|
|
|
|
112 |
message = comment['message']
|
113 |
log_message(f"Обработка комментария: {message}")
|
114 |
classification = classify_comment(message)
|
@@ -136,6 +143,7 @@ def process_comments(ACCESS_TOKEN):
|
|
136 |
"posts": processed_posts
|
137 |
}
|
138 |
|
|
|
139 |
with gr.Blocks() as demo:
|
140 |
with gr.Tab("Главная страница"):
|
141 |
gr.Markdown("# Facebook Comment Filter")
|
|
|
100 |
log_message(f"ID страницы: {page_id}")
|
101 |
|
102 |
processed_posts = []
|
103 |
+
processed_comment_ids = set() # Отслеживание обработанных комментариев
|
104 |
|
105 |
for post_data in posts_with_unanswered_comments:
|
106 |
post_id = post_data['post_id']
|
|
|
110 |
post_replies = []
|
111 |
|
112 |
for comment in unanswered_comments:
|
113 |
+
comment_id = comment['id']
|
114 |
+
if comment_id in processed_comment_ids:
|
115 |
+
log_message(f"Комментарий {comment_id} уже обработан. Пропуск.")
|
116 |
+
continue
|
117 |
+
processed_comment_ids.add(comment_id)
|
118 |
+
|
119 |
message = comment['message']
|
120 |
log_message(f"Обработка комментария: {message}")
|
121 |
classification = classify_comment(message)
|
|
|
143 |
"posts": processed_posts
|
144 |
}
|
145 |
|
146 |
+
|
147 |
with gr.Blocks() as demo:
|
148 |
with gr.Tab("Главная страница"):
|
149 |
gr.Markdown("# Facebook Comment Filter")
|