PLXR commited on
Commit
f6a81b8
ยท
verified ยท
1 Parent(s): 3e641e6

Create logic_seo.py

Browse files
Files changed (1) hide show
  1. logic_seo.py +56 -0
logic_seo.py ADDED
@@ -0,0 +1,56 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import time
2
+ from google.genai import types
3
+ from config_style import THUMBNAIL_STRATEGIES
4
+
5
+ def get_youtube_planner_prompt(text):
6
+ return f"""
7
+ ๋‹น์‹ ์€ ๋Œ€ํ•œ๋ฏผ๊ตญ ์ตœ๊ณ ์˜ ์œ ํŠœ๋ธŒ ์•Œ๊ณ ๋ฆฌ์ฆ˜ ์ „๋ฌธ๊ฐ€์ด์ž ๋ฐ”์ด๋Ÿด ๋งˆ์ผ€ํŒ… ์ฒœ์žฌ์ž…๋‹ˆ๋‹ค.
8
+ ์•„๋ž˜ ๋Œ€๋ณธ์„ ๋ถ„์„ํ•ด์„œ, ํด๋ฆญ๋ฅ (CTR)๊ณผ ์‹œ์ฒญ ์ง€์† ์‹œ๊ฐ„์„ ๊ทน๋Œ€ํ™”ํ•  ์ˆ˜ ์žˆ๋Š” '์˜์ƒ ํŒจํ‚ค์ง•'์„ ๊ธฐํšํ•˜์„ธ์š”.
9
+
10
+ [๋Œ€๋ณธ ๋‚ด์šฉ]
11
+ {text}
12
+
13
+ [์š”๊ตฌ์‚ฌํ•ญ]
14
+ 1. **์ œ๋ชฉ (5๊ฐœ):** - ํ˜ธ๊ธฐ์‹ฌ ์ž๊ทน, ์ถฉ๊ฒฉ, ๋ฐ˜์ „, ์งˆ๋ฌธํ˜• ๋“ฑ ๊ฐ•๋ ฅํ•œ ํ›„ํ‚น ๋ฉ˜ํŠธ ์‚ฌ์šฉ.
15
+ 2. **์„ค๋ช…๋ž€:** - ์ฒซ 2์ค„์€ ๊ฐ•๋ ฅํ•œ ํ›„ํ‚น. SEO ํ‚ค์›Œ๋“œ ํฌํ•จ.
16
+ 3. **ํƒœ๊ทธ:** - ๊ฒ€์ƒ‰๋Ÿ‰ ๋งŽ์€ ํ‚ค์›Œ๋“œ + ๋กฑํ…Œ์ผ ํ‚ค์›Œ๋“œ 15๊ฐœ ๋‚ด์™ธ (์‰ผํ‘œ๋กœ ๊ตฌ๋ถ„).
17
+
18
+ [์ถœ๋ ฅ ํ˜•์‹]
19
+ ---TITLE---
20
+ (์ œ๋ชฉ ๋‚ด์šฉ๋“ค)
21
+ ---DESC---
22
+ (์„ค๋ช… ๋‚ด์šฉ๋“ค)
23
+ ---TAGS---
24
+ (ํƒœ๊ทธ1, ํƒœ๊ทธ2, ํƒœ๊ทธ3)
25
+ """
26
+
27
+ def get_thumbnail_prompt_gen(text, strategy_name, strategy_prompt):
28
+ return f"""
29
+ Act as a Professional Thumbnail Designer.
30
+ Analyze the script and generate an Image Generation Prompt based on the specific strategy below.
31
+
32
+ [Script]
33
+ {text[:1500]}...
34
+
35
+ [Strategy: {strategy_name}]
36
+ {strategy_prompt}
37
+
38
+ **EXTREMELY IMPORTANT RULES:**
39
+ 1. **TEXT LANGUAGE:** Any text that appears INSIDE the image (e.g., 'text: "..."') **MUST BE IN KOREAN**.
40
+ - Do NOT translate the catchy phrases from the script into English.
41
+ - The prompt description itself is in English, but the *content of the text overlay* is Korean.
42
+
43
+ 2. **STYLE:** Adhere strictly to the visual style (Realistic vs 2D vs Hybrid).
44
+
45
+ **Task:**
46
+ Write the FINAL English prompt that will be fed into an AI Image Generator.
47
+ DO NOT include explanations. JUST the prompt.
48
+ """
49
+
50
+ def generate_planning_task(key, strategy_prompt, script_input, client, model_id):
51
+ try:
52
+ sys_msg = get_thumbnail_prompt_gen(script_input, key, strategy_prompt)
53
+ resp = client.models.generate_content(model=model_id, contents=sys_msg)
54
+ return key, resp.text.strip()
55
+ except Exception as e:
56
+ return key, f"Error: {str(e)}"