svjack commited on
Commit
25be453
·
verified ·
1 Parent(s): 9c860a7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +34 -0
app.py CHANGED
@@ -20,11 +20,45 @@ def read_csv_prefix(file, n_lines=128):
20
  def generate_prompts(user_input, csv_prompts, prefix, num_examples=3, language='English'):
21
  """基于用户输入和 CSV 提示生成多个新提示词"""
22
  # 构建系统提示
 
23
  system_prompt = (
24
  f"你是一位自然诗人,请将以下内容转化为{'英文' if language == 'English' else '中文'}的风景描写。"
25
  "请确保风格与提供的 CSV 中的描述一致,并以统一前缀 '{prefix}' 开头。"
26
  "请生成 {num_examples} 条不同风格的结果,每条结果不要加编号,且保持简洁自然。注意:输出语言必须与要求一致。"
27
  )
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
28
 
29
  # 拼接用户输入和 CSV 内容
30
  user_content = f"转换以下内容:\n{user_input}\n\n参考示例:\n" + "\n".join(csv_prompts[:5])
 
20
  def generate_prompts(user_input, csv_prompts, prefix, num_examples=3, language='English'):
21
  """基于用户输入和 CSV 提示生成多个新提示词"""
22
  # 构建系统提示
23
+ '''
24
  system_prompt = (
25
  f"你是一位自然诗人,请将以下内容转化为{'英文' if language == 'English' else '中文'}的风景描写。"
26
  "请确保风格与提供的 CSV 中的描述一致,并以统一前缀 '{prefix}' 开头。"
27
  "请生成 {num_examples} 条不同风格的结果,每条结果不要加编号,且保持简洁自然。注意:输出语言必须与要求一致。"
28
  )
29
+ '''
30
+
31
+ system_prompt = (
32
+ "你是一位专业的动漫视觉艺术家助手,负责根据用户输入生成符合 Wan 2.1 格式的文本提示词。\n"
33
+ "请严格按照以下结构组织输出内容:\n\n"
34
+
35
+ "1. 风格指定(Style Specification):明确画面风格,例如 'anime style' 或特定艺术风格如 'in the style of Kinich'。\n"
36
+ "2. 场景描述(Scene Description):详细描述环境与背景,包括光影、天气、氛围等元素。\n"
37
+ "3. 主体特征(Subject Features):描述主要人物或对象的外貌、服装、动作等细节。\n"
38
+ "4. 动态元素(Motion Elements):如果是视频,请加入动作或场景变化,如角色移动、镜头推进等。\n"
39
+ "5. 情感与氛围(Mood & Atmosphere):强调整体情绪,如宁静、浪漫、神秘等。\n"
40
+ "6. 特殊效果(Special Effects):添加增强表现力的细节,如光效、粒子、天气动态等。\n\n"
41
+
42
+ "以下是几个高质量提示词示例供你参考:\n\n"
43
+
44
+ "【示例 1】\n"
45
+ "In the style of anime landscape, 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
+ "In the style of anime landscape, 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
+ "In the style of anime landscape, 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
+ "In the style of anime landscape, 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
+ "In the style of anime landscape, 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}' 开头,使用{'英文' if language == 'English' else '中文'}输出,且每条提示词之间用空行分隔。\n"
60
+ "不要编号、不加额外解释,保持自然流畅。"
61
+ )
62
 
63
  # 拼接用户输入和 CSV 内容
64
  user_content = f"转换以下内容:\n{user_input}\n\n参考示例:\n" + "\n".join(csv_prompts[:5])