Skip to content

Commit

Permalink
image_cat_wall: no top cat? skip it
Browse files Browse the repository at this point in the history
  • Loading branch information
dale-wahl committed Jan 8, 2025
1 parent b0889ae commit 9465cc2
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions processors/visualisation/image_category_wall.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,6 +231,9 @@ def process(self):
category_type = float
# Special case
top_cats = post.get("top_categories")
if not top_cats:
self.dataset.log(f"Post {post.get('id')} has no top categories; skipping")
continue
top_cat = top_cats.split(",")[0].split(":")[0].strip()
top_cat_score = float(top_cats.split(",")[0].split(":")[1].strip().replace("%", ""))
post_result = {"id": post.get("id"), "value": top_cat_score, "top_cats": top_cats}
Expand Down

0 comments on commit 9465cc2

Please sign in to comment.