文生图网站

Vega AI 创作平台

文生图网站_第1张图片

import random


def generate_outfit(gender):
    if gender == "男":
        # 男性服饰生成代码
        hairstyles = [{"发型": "短发", "长度": "短"}, {"发型": "长发", "长度": "长"}, {"发型": "光头", "长度": "无"}, {"发型": "中分", "长度": "中"}, {"发型": "卷发", "长度": "中"}]
        clothes = [{"服装": "衬衫", "颜色": "白色"}, {"服装": "T恤", "颜色": "黑色"}, {"服装": "夹克", "颜色": "蓝色"}, {"服装": "西装", "颜色": "灰色"}, {"服装": "风衣", "颜色": "黑色"}]
        pants = [{"裤子": "牛仔裤", "款式": "修身"}, {"裤子": "休闲裤", "款式": "宽松"}, {"裤子": "西裤", "款式": "正装"}, {"裤子": "短裤", "款式": "休闲"}, {"裤子": "工装裤", "款式": "耐穿"}]
        shoes = [{"鞋子": "运动鞋", "品牌": "Nike"}, {"鞋子": "皮鞋", "品牌": "Gucci"}, {"鞋子": "帆布鞋", "品牌": "Converse"}, {"鞋子": "靴子", "品牌": "Timberland"}, {"鞋子": "凉鞋", "品牌": "Birkenstock"}]

        hairstyle = random.choice(hairstyles)
        cloth = random.choice(clothes)
        pant = random.choice(pants)
        shoe = random.choice(shoes)

        return f"男性外貌:发型-{hairstyle['发型']},长度-{hairstyle['长度']},服装-{cloth['服装']},颜色-{cloth['颜色']},裤子-{pant['裤子']},款式-{pant['款式']},鞋子-{shoe['鞋子']},品牌-{shoe['品牌']}"

    elif gender == "女":
        # 女性服饰生成代码
        hairstyles = [{"发型": "长发", "长度": "长"}, {"发型": "短发", "长度": "短"}, {"发型": "马尾", "长度": "中"}, {"发型": "盘发", "长度": "长"}, {"发型": "编发", "长度": "长"}]
        clothes = [{"服装": "连衣裙", "颜色": "红色"}, {"服装": "半身裙", "颜色": "蓝色"}, {"服装": "衬衫", "颜色": "白色"}, {"服装": "西装", "颜色": "黑色"}, {"服装": "风衣", "颜色": "灰色"}]
        pants = [{"裤子": "牛仔裤", "款式": "修身"}, {"裤子": "阔腿裤", "款式": "宽松"}, {"裤子": "短裤", "款式": "休闲"}, {"裤子": "裙子", "款式": "甜美"}, {"裤子": "工装裤", "款式": "耐穿"}]
        shoes = [{"鞋子": "高跟鞋", "品牌": "Jimmy Choo"}, {"鞋子": "运动鞋", "品牌": "Adidas"}, {"鞋子": "凉鞋", "品牌": "Teva"}, {"鞋子": "靴子", "品牌": "UGG"}, {"鞋子": "平底鞋", "品牌": "Tory Burch"}]

        hairstyle = random.choice(hairstyles)
        cloth = random.choice(clothes)
        pant = random.choice(pants)
        shoe = random.choice(shoes)

        return f"女性外貌:发型-{hairstyle['发型']},长度-{hairstyle['长度']},服装-{cloth['服装']},颜色-{cloth['颜色']},裤子-{pant['裤子']},款式-{pant['款式']},鞋子-{shoe['鞋子']},品牌-{shoe['品牌']}"

    else:
        return "请输入正确的性别(男/女)"


# 生成男性外貌
male_outfit = generate_outfit("男")
print(male_outfit)

# 生成女性外貌
# female_outfit = generate_outfit("女")
# print(female_outfit)

你可能感兴趣的:(已解决,前端,数据库,服务器)