Spaces:
Running
Running
Update sugg_gene.py
Browse files- sugg_gene.py +34 -34
sugg_gene.py
CHANGED
@@ -1,34 +1,34 @@
|
|
1 |
-
from suggestion import generate_outfit_advice
|
2 |
-
from clothGen import pro_gen
|
3 |
-
import os
|
4 |
-
from openai import OpenAI
|
5 |
-
|
6 |
-
os.environ["OPENAI_API_KEY"] = "sk-vtyR3fdgk08jmJ5e3eF6F5Ef663c4a3bAd0166C3549a1a8e"
|
7 |
-
os.environ["OPENAI_BASE_URL"] = "http://15.204.101.64:4000/v1"
|
8 |
-
|
9 |
-
|
10 |
-
def suggest_gene(user_name, height, weight, waist, chest, hip, shoulder_width, leg_length, arm_length, gender,
|
11 |
-
body_type, skin_color, style_preference, lifestyle_requirements, special_requirements,
|
12 |
-
feedback, user_pic):
|
13 |
-
analyse = generate_outfit_advice(user_name, height, weight, waist, chest, hip, shoulder_width, leg_length,
|
14 |
-
arm_length, gender, body_type, skin_color, style_preference,
|
15 |
-
lifestyle_requirements, special_requirements, feedback, user_pic)
|
16 |
-
prompts = ""
|
17 |
-
for i in range(1, 4):
|
18 |
-
prompts += pro_gen(analyse, gender, i)
|
19 |
-
|
20 |
-
client = OpenAI()
|
21 |
-
completion = client.chat.completions.create(
|
22 |
-
model="gpt-4o",
|
23 |
-
messages=[
|
24 |
-
{"role": "system",
|
25 |
-
"content": "You are a helpful assistant.", },
|
26 |
-
{"role": "user",
|
27 |
-
"content": "你是一位专业的民族服饰搭配大师,你需要充分了解中华民族的所有民族服饰的相关知识,包括不同民族服饰适合什么样的人群等。"
|
28 |
-
"
|
29 |
-
}
|
30 |
-
]
|
31 |
-
|
32 |
-
)
|
33 |
-
print(completion.choices[0].message.content)
|
34 |
-
return completion.choices[0].message.content
|
|
|
1 |
+
from suggestion import generate_outfit_advice
|
2 |
+
from clothGen import pro_gen
|
3 |
+
import os
|
4 |
+
from openai import OpenAI
|
5 |
+
|
6 |
+
os.environ["OPENAI_API_KEY"] = "sk-vtyR3fdgk08jmJ5e3eF6F5Ef663c4a3bAd0166C3549a1a8e"
|
7 |
+
os.environ["OPENAI_BASE_URL"] = "http://15.204.101.64:4000/v1"
|
8 |
+
|
9 |
+
|
10 |
+
def suggest_gene(user_name, height, weight, waist, chest, hip, shoulder_width, leg_length, arm_length, gender,
|
11 |
+
body_type, skin_color, style_preference, lifestyle_requirements, special_requirements,
|
12 |
+
feedback, user_pic):
|
13 |
+
analyse = generate_outfit_advice(user_name, height, weight, waist, chest, hip, shoulder_width, leg_length,
|
14 |
+
arm_length, gender, body_type, skin_color, style_preference,
|
15 |
+
lifestyle_requirements, special_requirements, feedback, user_pic)
|
16 |
+
prompts = ""
|
17 |
+
for i in range(1, 4):
|
18 |
+
prompts += pro_gen(analyse, gender, i)
|
19 |
+
|
20 |
+
client = OpenAI()
|
21 |
+
completion = client.chat.completions.create(
|
22 |
+
model="gpt-4o",
|
23 |
+
messages=[
|
24 |
+
{"role": "system",
|
25 |
+
"content": "You are a helpful assistant.", },
|
26 |
+
{"role": "user",
|
27 |
+
"content": "你是一位专业的民族服饰搭配大师,你需要充分了解中华民族的所有民族服饰的相关知识,包括不同民族服饰适合什么样的人群等。"
|
28 |
+
"以下是用户分析与三套服装描述,请据此给出穿搭建议,要求以三段提示词为主要建议参考" + analyse + prompts,
|
29 |
+
}
|
30 |
+
]
|
31 |
+
|
32 |
+
)
|
33 |
+
print(completion.choices[0].message.content)
|
34 |
+
return completion.choices[0].message.content
|