Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -42,31 +42,34 @@ def generate_prompts(user_input, csv_prompts, prefix, num_examples=3, language='
|
|
42 |
"以下是几个高质量提示词示例供你参考:\n\n"
|
43 |
|
44 |
"【示例 1】\n"
|
45 |
-
"
|
46 |
|
47 |
"【示例 2】\n"
|
48 |
-
"
|
49 |
|
50 |
"【示例 3】\n"
|
51 |
-
"
|
52 |
|
53 |
"【示例 4】\n"
|
54 |
-
"
|
55 |
|
56 |
"【示例 5】\n"
|
57 |
-
"
|
58 |
|
59 |
-
"请确保每条提示词以 '{prefix}' 开头,使用{
|
60 |
"不要编号、不加额外解释,保持自然流畅。"
|
61 |
)
|
62 |
|
63 |
# 拼接用户输入和 CSV 内容
|
64 |
user_content = f"转换以下内容:\n{user_input}\n\n参考示例:\n" + "\n".join(csv_prompts[:num_examples])
|
65 |
-
|
|
|
|
|
|
|
66 |
response = client.chat.completions.create(
|
67 |
model="deepseek-chat",
|
68 |
messages=[
|
69 |
-
{"role": "system", "content": system_prompt.format(prefix=prefix, num_examples=num_examples, language
|
70 |
{"role": "user", "content": user_content}
|
71 |
],
|
72 |
temperature=0.7,
|
|
|
42 |
"以下是几个高质量提示词示例供你参考:\n\n"
|
43 |
|
44 |
"【示例 1】\n"
|
45 |
+
"{prefix} Golden light filters through the canopy, illuminating soft moss and fallen leaves. Wildflowers bloom nearby, and glowing fireflies hover in the air. A gentle stream flows in the background, its murmur blending with birdsong. The scene radiates tranquility and natural charm.\n\n"
|
46 |
|
47 |
"【示例 2】\n"
|
48 |
+
"{prefix} A majestic castle under a starry sky with silvery moonlight casting soft shadows. Towering spires rise into the night, their peaks adorned with glowing orbs that mimic the stars above. Fireflies dance around the castle’s ivy-covered arches, adding a touch of magic to the scene.\n\n"
|
49 |
|
50 |
"【示例 3】\n"
|
51 |
+
"{prefix} The video shifts to a breathtaking coastal scene. The turquoise sea stretches endlessly, its waves gently lapping against the golden sandy shore. Rocky cliffs rise along the coastline, their jagged edges softened by patches of green vegetation. Seafoam glistens as it washes ashore, and the air is filled with the soothing sound of the tide.\n\n"
|
52 |
|
53 |
"【示例 4】\n"
|
54 |
+
"{prefix} As the scene progresses, a pink lunar disc gradually emerges from pitch-black night, with violet clouds rolling like waves, the unearthly moonlight casting shifting halos across the drifting cloud sea.\n\n"
|
55 |
|
56 |
"【示例 5】\n"
|
57 |
+
"{prefix} A young male character with teal and dark blue tousled hair adorned with geometric neon patterns charges forward — left hand crackling with a swirling energy orb, right arm outstretched, trailing luminous particles. Behind him, shattered urban ruins float amidst explosive shockwaves.\n\n"
|
58 |
|
59 |
+
"请确保每条提示词以 '{prefix}' 开头,使用 {language} 输出,且每条提示词之间用空行分隔。\n"
|
60 |
"不要编号、不加额外解释,保持自然流畅。"
|
61 |
)
|
62 |
|
63 |
# 拼接用户输入和 CSV 内容
|
64 |
user_content = f"转换以下内容:\n{user_input}\n\n参考示例:\n" + "\n".join(csv_prompts[:num_examples])
|
65 |
+
|
66 |
+
# 替换为:
|
67 |
+
language_label = "英文" if language == "English" else "中文"
|
68 |
+
|
69 |
response = client.chat.completions.create(
|
70 |
model="deepseek-chat",
|
71 |
messages=[
|
72 |
+
{"role": "system", "content": system_prompt.format(prefix=prefix, num_examples=num_examples, language=language_label)},
|
73 |
{"role": "user", "content": user_content}
|
74 |
],
|
75 |
temperature=0.7,
|