Spaces:
Running
Running
Update app.py
Browse filesfixed '[character'](KeyError: 'character')
app.py
CHANGED
|
@@ -87,19 +87,17 @@ class Tagger:
|
|
| 87 |
res["ratings"][tag_name] = float(outputs[idx])
|
| 88 |
tag_categories_for_translation["ratings"].append(tag_name)
|
| 89 |
|
| 90 |
-
|
| 91 |
for idx in self.categories["general"]:
|
| 92 |
if outputs[idx] > gen_th:
|
| 93 |
tag_name = self.tag_names[idx].replace("_", " ")
|
| 94 |
res["general"][tag_name] = float(outputs[idx])
|
| 95 |
tag_categories_for_translation["general"].append(tag_name)
|
| 96 |
|
| 97 |
-
|
| 98 |
for idx in self.categories["character"]:
|
| 99 |
if outputs[idx] > char_th:
|
| 100 |
tag_name = self.tag_names[idx].replace("_", " ")
|
| 101 |
res["characters"][tag_name] = float(outputs[idx])
|
| 102 |
-
tag_categories_for_translation["
|
| 103 |
|
| 104 |
|
| 105 |
res["general"] = dict(sorted(res["general"].items(), key=lambda kv: kv[1], reverse=True))
|
|
|
|
| 87 |
res["ratings"][tag_name] = float(outputs[idx])
|
| 88 |
tag_categories_for_translation["ratings"].append(tag_name)
|
| 89 |
|
|
|
|
| 90 |
for idx in self.categories["general"]:
|
| 91 |
if outputs[idx] > gen_th:
|
| 92 |
tag_name = self.tag_names[idx].replace("_", " ")
|
| 93 |
res["general"][tag_name] = float(outputs[idx])
|
| 94 |
tag_categories_for_translation["general"].append(tag_name)
|
| 95 |
|
|
|
|
| 96 |
for idx in self.categories["character"]:
|
| 97 |
if outputs[idx] > char_th:
|
| 98 |
tag_name = self.tag_names[idx].replace("_", " ")
|
| 99 |
res["characters"][tag_name] = float(outputs[idx])
|
| 100 |
+
tag_categories_for_translation["characters"].append(tag_name)
|
| 101 |
|
| 102 |
|
| 103 |
res["general"] = dict(sorted(res["general"].items(), key=lambda kv: kv[1], reverse=True))
|