Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -178,7 +178,7 @@ def generate_transformed_output(prompt, gender_option, top_cat, sub_cat, species
|
|
| 178 |
furry_path = f"{top_cat} > {sub_cat} > {species_item}" if (top_cat and sub_cat and species_item) else "unknown"
|
| 179 |
species_data = FURRY_DATA.get(top_cat, {}).get(sub_cat, [])
|
| 180 |
species_details = next((item["Details"] for item in species_data if item["Name"] == species_item), "unknown details")
|
| 181 |
-
gender_desc = ", ".join([g.lower() for g in
|
| 182 |
extra_line = f"\nfurry {gender_desc} {furry_path} {species_details} anthro character\n"
|
| 183 |
else:
|
| 184 |
extra_line = ""
|
|
@@ -322,6 +322,8 @@ def build_interface():
|
|
| 322 |
value=["Male"], # 默认公
|
| 323 |
visible=False # 默认隐藏,仅在 Furry 选项时显示
|
| 324 |
)
|
|
|
|
|
|
|
| 325 |
def show_furry_options(opt):
|
| 326 |
if opt == "Trans_to_Furry":
|
| 327 |
return (gr.update(visible=True),
|
|
@@ -387,7 +389,7 @@ def build_interface():
|
|
| 387 |
######################################################################
|
| 388 |
# 生成
|
| 389 |
######################################################################
|
| 390 |
-
def on_generate(prompt, gender,
|
| 391 |
# Step 1: 强制替换用户输入
|
| 392 |
direction = transform_map.get(gender, None)
|
| 393 |
if direction:
|
|
@@ -400,19 +402,19 @@ def build_interface():
|
|
| 400 |
if gender == "Trans_to_Furry":
|
| 401 |
furry_path = f"{tc} > {sc} > {spc}" if (tc and sc and spc) else "unknown"
|
| 402 |
species_details = FURRY_DATA.get(tc, {}).get(sc, {}).get(spc, {}).get("Details", "")
|
| 403 |
-
gender_description = ", ".join([g.lower() for g in
|
| 404 |
prompt += f", Furry: {furry_path}, {gender_description}, {species_details}" # 添加 Furry 类目路径
|
| 405 |
|
| 406 |
# 添加性别描述(如果选择了性别)
|
| 407 |
-
if
|
| 408 |
-
gender_description = ", ".join([g.lower() for g in
|
| 409 |
prompt += f", {gender_description}" # 将性别描述附加到提示词
|
| 410 |
|
| 411 |
# Debug 添加性别后的 Prompt
|
| 412 |
print(f"Debug Prompt with Furry Gender: {prompt}")
|
| 413 |
|
| 414 |
# Step 3: 提交到生成器
|
| 415 |
-
merged_output = generate_transformed_output(prompt, gender, tc, sc, spc, mode, key)
|
| 416 |
|
| 417 |
# Debug 生成器输出
|
| 418 |
print(f"Debug Merged Output: {merged_output}")
|
|
|
|
| 178 |
furry_path = f"{top_cat} > {sub_cat} > {species_item}" if (top_cat and sub_cat and species_item) else "unknown"
|
| 179 |
species_data = FURRY_DATA.get(top_cat, {}).get(sub_cat, [])
|
| 180 |
species_details = next((item["Details"] for item in species_data if item["Name"] == species_item), "unknown details")
|
| 181 |
+
gender_desc = ", ".join([g.lower() for g in gender_selection_furry]) if gender_selection_furry else "neutral"
|
| 182 |
extra_line = f"\nfurry {gender_desc} {furry_path} {species_details} anthro character\n"
|
| 183 |
else:
|
| 184 |
extra_line = ""
|
|
|
|
| 322 |
value=["Male"], # 默认公
|
| 323 |
visible=False # 默认隐藏,仅在 Furry 选项时显示
|
| 324 |
)
|
| 325 |
+
|
| 326 |
+
|
| 327 |
def show_furry_options(opt):
|
| 328 |
if opt == "Trans_to_Furry":
|
| 329 |
return (gr.update(visible=True),
|
|
|
|
| 389 |
######################################################################
|
| 390 |
# 生成
|
| 391 |
######################################################################
|
| 392 |
+
def on_generate(prompt, gender, gender_selection_furry, tc, sc, spc, mode, key, lang):
|
| 393 |
# Step 1: 强制替换用户输入
|
| 394 |
direction = transform_map.get(gender, None)
|
| 395 |
if direction:
|
|
|
|
| 402 |
if gender == "Trans_to_Furry":
|
| 403 |
furry_path = f"{tc} > {sc} > {spc}" if (tc and sc and spc) else "unknown"
|
| 404 |
species_details = FURRY_DATA.get(tc, {}).get(sc, {}).get(spc, {}).get("Details", "")
|
| 405 |
+
gender_description = ", ".join([g.lower() for g in gender_selection_furry]) if gender_selection_furry else "neutral"
|
| 406 |
prompt += f", Furry: {furry_path}, {gender_description}, {species_details}" # 添加 Furry 类目路径
|
| 407 |
|
| 408 |
# 添加性别描述(如果选择了性别)
|
| 409 |
+
if gender_selection_furry:
|
| 410 |
+
gender_description = ", ".join([g.lower() for g in gender_selection_furry]) # 转换为小写
|
| 411 |
prompt += f", {gender_description}" # 将性别描述附加到提示词
|
| 412 |
|
| 413 |
# Debug 添加性别后的 Prompt
|
| 414 |
print(f"Debug Prompt with Furry Gender: {prompt}")
|
| 415 |
|
| 416 |
# Step 3: 提交到生成器
|
| 417 |
+
merged_output = generate_transformed_output(prompt, gender, gender_selection_furry, tc, sc, spc, mode, key)
|
| 418 |
|
| 419 |
# Debug 生成器输出
|
| 420 |
print(f"Debug Merged Output: {merged_output}")
|