Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -38,7 +38,9 @@ def get_sub_categories(furry_data, top_category):
|
|
| 38 |
|
| 39 |
def get_species_list(furry_data, top_category, sub_category):
|
| 40 |
if top_category in furry_data and sub_category in furry_data[top_category]:
|
| 41 |
-
|
|
|
|
|
|
|
| 42 |
return []
|
| 43 |
|
| 44 |
##############################################################################
|
|
@@ -171,8 +173,9 @@ def generate_transformed_output(prompt, gender_option, top_cat, sub_cat, species
|
|
| 171 |
|
| 172 |
if gender_option == "Trans_to_Furry":
|
| 173 |
furry_path = f"{top_cat} > {sub_cat} > {species_item}" if (top_cat and sub_cat and species_item) else "unknown"
|
|
|
|
|
|
|
| 174 |
gender_desc = ", ".join([g.lower() for g in furry_gender]) if furry_gender else "neutral"
|
| 175 |
-
species_details = FURRY_DATA.get(top_cat, {}).get(sub_cat, {}).get(species_item, {}).get("Details", "")
|
| 176 |
extra_line = f"\nfurry {gender_desc} {furry_path} {species_details} anthro character\n"
|
| 177 |
else:
|
| 178 |
extra_line = ""
|
|
@@ -310,7 +313,7 @@ def build_interface():
|
|
| 310 |
visible=False
|
| 311 |
)
|
| 312 |
|
| 313 |
-
gender_selection_furry = gr.
|
| 314 |
label="Furry Gender Selection (选择Furry性别)",
|
| 315 |
choices=["Male", "Female"],
|
| 316 |
value=["Male"], # 默认公
|
|
@@ -345,7 +348,7 @@ def build_interface():
|
|
| 345 |
)
|
| 346 |
|
| 347 |
def on_sub_cat_select(top_c, sub_c):
|
| 348 |
-
|
| 349 |
return gr.update(choices=sp, value=None)
|
| 350 |
|
| 351 |
sub_cat_dd.change(
|
|
|
|
| 38 |
|
| 39 |
def get_species_list(furry_data, top_category, sub_category):
|
| 40 |
if top_category in furry_data and sub_category in furry_data[top_category]:
|
| 41 |
+
# 从嵌套结构中提取 Name 字段
|
| 42 |
+
species = furry_data[top_category][sub_category]
|
| 43 |
+
return [item["Name"] for item in species]
|
| 44 |
return []
|
| 45 |
|
| 46 |
##############################################################################
|
|
|
|
| 173 |
|
| 174 |
if gender_option == "Trans_to_Furry":
|
| 175 |
furry_path = f"{top_cat} > {sub_cat} > {species_item}" if (top_cat and sub_cat and species_item) else "unknown"
|
| 176 |
+
species_data = FURRY_DATA.get(top_cat, {}).get(sub_cat, [])
|
| 177 |
+
species_details = next((item["Details"] for item in species_data if item["Name"] == species_item), "unknown details")
|
| 178 |
gender_desc = ", ".join([g.lower() for g in furry_gender]) if furry_gender else "neutral"
|
|
|
|
| 179 |
extra_line = f"\nfurry {gender_desc} {furry_path} {species_details} anthro character\n"
|
| 180 |
else:
|
| 181 |
extra_line = ""
|
|
|
|
| 313 |
visible=False
|
| 314 |
)
|
| 315 |
|
| 316 |
+
gender_selection_furry = gr.Column(
|
| 317 |
label="Furry Gender Selection (选择Furry性别)",
|
| 318 |
choices=["Male", "Female"],
|
| 319 |
value=["Male"], # 默认公
|
|
|
|
| 348 |
)
|
| 349 |
|
| 350 |
def on_sub_cat_select(top_c, sub_c):
|
| 351 |
+
species = get_species_list(FURRY_DATA, top_c, sub_c)
|
| 352 |
return gr.update(choices=sp, value=None)
|
| 353 |
|
| 354 |
sub_cat_dd.change(
|