r3gm commited on
Commit
b322cab
·
verified ·
1 Parent(s): d420c21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -282,7 +282,11 @@ class Predictor:
282
  # print(general_res_dict)
283
 
284
  # Prepare tag names for prompt (without confidence, no escaping yet)
285
- general_tag_names = [x[0].replace('_', ' ') for x in sorted(general_res_dict.items(), key=lambda x: x[1], reverse=True)]
 
 
 
 
286
  character_tag_names = [x[0].replace('_', ' ') for x in sorted(character_res_dict.items(), key=lambda x: x[1], reverse=True)]
287
 
288
  return general_tag_names, character_tag_names
@@ -375,7 +379,11 @@ def update_allowed_tags_set(selected_categories: list):
375
  # Get tags where the category column has a '1'
376
  # Convert to lower case for case-insensitive matching
377
  tags_in_category = _danbooru_tag_classifier_df[_danbooru_tag_classifier_df[category] == 1].index.tolist()
378
- allowed_tags_set.update(tag.replace('_', ' ').lower() for tag in tags_in_category)
 
 
 
 
379
 
380
  _preprocessed_allowed_tags_set = allowed_tags_set
381
  _last_selected_tag_categories = selected_categories
 
282
  # print(general_res_dict)
283
 
284
  # Prepare tag names for prompt (without confidence, no escaping yet)
285
+ # general_tag_names = [x[0].replace('_', ' ') for x in sorted(general_res_dict.items(), key=lambda x: x[1], reverse=True)]
286
+ general_tag_names = [
287
+ x[0] if x[0] in kaomojis else x[0].replace('_', ' ')
288
+ for x in sorted(general_res_dict.items(), key=lambda x: x[1], reverse=True)
289
+ ]
290
  character_tag_names = [x[0].replace('_', ' ') for x in sorted(character_res_dict.items(), key=lambda x: x[1], reverse=True)]
291
 
292
  return general_tag_names, character_tag_names
 
379
  # Get tags where the category column has a '1'
380
  # Convert to lower case for case-insensitive matching
381
  tags_in_category = _danbooru_tag_classifier_df[_danbooru_tag_classifier_df[category] == 1].index.tolist()
382
+ # allowed_tags_set.update(tag.replace('_', ' ').lower() for tag in tags_in_category)
383
+ allowed_tags_set.update(
384
+ tag.lower() if tag in kaomojis else tag.replace('_', ' ').lower()
385
+ for tag in tags_in_category
386
+ )
387
 
388
  _preprocessed_allowed_tags_set = allowed_tags_set
389
  _last_selected_tag_categories = selected_categories