Update app.py
Browse files
app.py
CHANGED
@@ -1,8 +1,9 @@
|
|
1 |
"""
|
2 |
-
|
3 |
-
|
4 |
-
|
5 |
-
|
|
|
6 |
"""
|
7 |
|
8 |
import os
|
@@ -13,6 +14,7 @@ from openai import OpenAI
|
|
13 |
from datetime import datetime
|
14 |
from typing import List, Dict, Tuple, Optional
|
15 |
import random
|
|
|
16 |
|
17 |
# OpenAI ํด๋ผ์ด์ธํธ
|
18 |
if not os.getenv("OPENAI_API_KEY"):
|
@@ -20,27 +22,142 @@ if not os.getenv("OPENAI_API_KEY"):
|
|
20 |
|
21 |
client = OpenAI()
|
22 |
|
23 |
-
#
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
THEORY_DESCRIPTIONS = {
|
25 |
-
"
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
40 |
}
|
41 |
|
42 |
-
# ํต์ผ๋ ๊ธฐ๋ณธ
|
43 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
44 |
๋น์ ์ {theory_name} ์ ๋ฌธ๊ฐ์
๋๋ค. {theory_description}
|
45 |
|
46 |
์ฌ์ฉ์ ์
๋ ฅ(์
์ข
/ํค์๋)์ ๋ฐ์ ๋ค์๊ณผ ๊ฐ์ ํต์ผ๋ JSON ํ์์ ๋ฐฐ์ด์ ์์ฑํ์ธ์:
|
@@ -88,10 +205,139 @@ UNIFIED_BASE_PROMPT = """
|
|
88 |
|
89 |
๋ฐ๋์ ์ ํจํ JSON ํ์์ผ๋ก ์๋ตํ๊ณ , ๋ชจ๋ ํ๋๋ฅผ ์ฑ์์ฃผ์ธ์.
|
90 |
๊ฐ ์ด๋ก ์ ํน์ฑ์ theory_specific ์น์
์ ๋ด๋, ๋๋จธ์ง๋ ํต์ผ๋ ๊ตฌ์กฐ๋ฅผ ์ ์งํ์ธ์.
|
|
|
91 |
"""
|
92 |
|
93 |
-
# ์ด๋ก ๋ณ ํน์ ํ๋ ์ ์
|
94 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
95 |
"square": """
|
96 |
"tl": "์ผ์ชฝ์๋จ",
|
97 |
"tr": "์ค๋ฅธ์ชฝ์๋จ",
|
@@ -218,46 +464,97 @@ THEORY_SPECIFIC_FIELDS = {
|
|
218 |
"""
|
219 |
}
|
220 |
|
221 |
-
def create_theory_prompt(theory: str) -> str:
|
222 |
"""๊ฐ ์ด๋ก ๋ณ ํต์ผ๋ ํ๋กฌํํธ ์์ฑ"""
|
223 |
theory_names = {
|
224 |
-
"
|
225 |
-
|
226 |
-
|
227 |
-
|
228 |
-
|
229 |
-
|
230 |
-
|
231 |
-
|
232 |
-
|
233 |
-
|
234 |
-
|
235 |
-
|
236 |
-
|
237 |
-
|
238 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
239 |
}
|
240 |
|
241 |
-
|
242 |
-
|
243 |
-
|
244 |
-
|
|
|
|
|
|
|
245 |
)
|
246 |
|
247 |
-
def generate_by_theory(industry: str, keywords: str, theory: str, count: int = 3) -> Tuple[str, str]:
|
248 |
"""ํน์ ์ด๋ก ์ผ๋ก ๋ธ๋๋ ์์ฑ"""
|
249 |
|
|
|
|
|
250 |
if not industry or not keywords:
|
251 |
-
return "
|
|
|
|
|
252 |
|
253 |
-
|
254 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
255 |
ํค์๋: {keywords}
|
256 |
|
257 |
์ ์ ๋ณด๋ก {count}๊ฐ์ ๋ธ๋๋๋ฅผ ์์ฑํ์ธ์.
|
258 |
๊ฐ ๋ธ๋๋๋ ํต์ผ๋ ๊ตฌ์กฐ๋ฅผ ๊ฐ์ง๋, theory_specific ์น์
์๋ {theory} ์ด๋ก ์ ํน์ฑ์ ๋ฐ์ํ์ธ์."""
|
259 |
|
260 |
try:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
261 |
response = client.chat.completions.create(
|
262 |
model="gpt-4o-mini",
|
263 |
messages=[
|
@@ -282,19 +579,19 @@ def generate_by_theory(industry: str, keywords: str, theory: str, count: int = 3
|
|
282 |
results = [results]
|
283 |
|
284 |
# ๋งํฌ๋ค์ด ์์ฑ
|
285 |
-
markdown = generate_unified_markdown(theory, results, industry, keywords)
|
286 |
|
287 |
# HTML ์๊ฐํ ์์ฑ
|
288 |
-
html = generate_unified_visualization(theory, results)
|
289 |
|
290 |
-
return markdown, html
|
291 |
|
292 |
except Exception as e:
|
293 |
-
error_msg =
|
294 |
print(error_msg)
|
295 |
-
return error_msg, ""
|
296 |
|
297 |
-
def generate_unified_markdown(theory: str, results: List[Dict], industry: str, keywords: str) -> str:
|
298 |
"""ํต์ผ๋ ๋งํฌ๋ค์ด ์์ฑ"""
|
299 |
|
300 |
theory_names = {
|
@@ -322,11 +619,27 @@ def generate_unified_markdown(theory: str, results: List[Dict], industry: str, k
|
|
322 |
"memetics": "๐งฌ", "color": "๐จ", "gestalt": "๐๏ธ"
|
323 |
}
|
324 |
|
325 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
326 |
|
327 |
<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 20px; border-radius: 10px; margin-bottom: 20px;">
|
328 |
<h3 style="margin: 0 0 10px 0;">์ด๋ก ๊ฐ์</h3>
|
329 |
-
<p style="margin: 0; line-height: 1.6;">{THEORY_DESCRIPTIONS[theory]}</p>
|
330 |
</div>
|
331 |
|
332 |
**์
์ข
**: {industry} | **ํค์๋**: {keywords}
|
@@ -347,10 +660,34 @@ def generate_unified_markdown(theory: str, results: List[Dict], industry: str, k
|
|
347 |
slogan = core.get('slogan', 'N/A')
|
348 |
|
349 |
markdown += f"\n## {idx}. {brand_name}\n"
|
350 |
-
markdown += f"**์ฌ๋ก๊ฑด**: *\"{slogan}\"*\n\n"
|
351 |
|
352 |
-
|
353 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
354 |
- **ํต์ฌ ๊ฐ์น**: {core.get('core_value', 'N/A')}
|
355 |
- **๋ชฉํ ๊ฐ์ **: {core.get('target_emotion', 'N/A')}
|
356 |
- **๋ธ๋๋ ์ฑ๊ฒฉ**: {core.get('brand_personality', 'N/A')}
|
@@ -373,18 +710,30 @@ def generate_unified_markdown(theory: str, results: List[Dict], industry: str, k
|
|
373 |
|
374 |
# ์ด๋ก ๋ณ ํน์ ์ ๋ณด
|
375 |
if theory_specific:
|
376 |
-
|
|
|
377 |
for key, value in theory_specific.items():
|
378 |
-
# ํค๋ฅผ ์ฝ๊ธฐ ์ฌ์ด ํํ๋ก ๋ณํ
|
379 |
display_key = key.replace('_', ' ').title()
|
380 |
markdown += f"- **{display_key}**: {value}\n"
|
381 |
|
382 |
# ํ๊ฐ ์ ์
|
383 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
384 |
### ๐ ํ๊ฐ
|
385 |
-
-
|
386 |
-
-
|
387 |
-
-
|
388 |
|
389 |
๐ฌ **์ ์ฒด ํ๊ฐ**: {evaluation.get('overall_effectiveness', 'N/A')}
|
390 |
"""
|
@@ -393,9 +742,12 @@ def generate_unified_markdown(theory: str, results: List[Dict], industry: str, k
|
|
393 |
|
394 |
return markdown
|
395 |
|
396 |
-
def generate_unified_visualization(theory: str, results: List[Dict]) -> str:
|
397 |
"""ํต์ผ๋ ์๊ฐํ ์์ฑ"""
|
398 |
|
|
|
|
|
|
|
399 |
html_parts = []
|
400 |
|
401 |
for idx, result in enumerate(results, 1):
|
@@ -410,6 +762,22 @@ def generate_unified_visualization(theory: str, results: List[Dict]) -> str:
|
|
410 |
slogan = core.get('slogan', '')
|
411 |
primary_color = visual.get('primary_color', '#667eea')
|
412 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
413 |
# ํต์ผ๋ ์นด๋ ๋ ์ด์์
|
414 |
html = f"""
|
415 |
<div style="max-width: 800px; margin: 30px auto; font-family: -apple-system, sans-serif;">
|
@@ -428,38 +796,38 @@ def generate_unified_visualization(theory: str, results: List[Dict]) -> str:
|
|
428 |
<div style="font-size: 2em; color: {primary_color}; font-weight: bold;">
|
429 |
{evaluation.get('creativity_score', 0)}/10
|
430 |
</div>
|
431 |
-
<div style="color: #7f8c8d; margin-top: 5px;"
|
432 |
</div>
|
433 |
<div style="text-align: center;">
|
434 |
<div style="font-size: 2em; color: {primary_color}; font-weight: bold;">
|
435 |
{evaluation.get('memorability_score', 0)}/10
|
436 |
</div>
|
437 |
-
<div style="color: #7f8c8d; margin-top: 5px;"
|
438 |
</div>
|
439 |
<div style="text-align: center;">
|
440 |
<div style="font-size: 2em; color: {primary_color}; font-weight: bold;">
|
441 |
{evaluation.get('relevance_score', 0)}/10
|
442 |
</div>
|
443 |
-
<div style="color: #7f8c8d; margin-top: 5px;"
|
444 |
</div>
|
445 |
</div>
|
446 |
|
447 |
<!-- ํต์ฌ ์ ๋ณด ๊ทธ๋ฆฌ๋ -->
|
448 |
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 30px;">
|
449 |
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px;">
|
450 |
-
<h4 style="margin: 0 0 10px 0; color: {primary_color};"
|
451 |
<p style="margin: 0; color: #555;">{core.get('core_value', 'N/A')}</p>
|
452 |
</div>
|
453 |
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px;">
|
454 |
-
<h4 style="margin: 0 0 10px 0; color: {primary_color};"
|
455 |
<p style="margin: 0; color: #555;">{core.get('target_emotion', 'N/A')}</p>
|
456 |
</div>
|
457 |
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px;">
|
458 |
-
<h4 style="margin: 0 0 10px 0; color: {primary_color};"
|
459 |
<p style="margin: 0; color: #555;">{strategic.get('differentiation', 'N/A')}</p>
|
460 |
</div>
|
461 |
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px;">
|
462 |
-
<h4 style="margin: 0 0 10px 0; color: {primary_color};"
|
463 |
<p style="margin: 0; color: #555;">{linguistic.get('pronunciation', 'N/A')}</p>
|
464 |
</div>
|
465 |
</div>
|
@@ -474,9 +842,10 @@ def generate_unified_visualization(theory: str, results: List[Dict]) -> str:
|
|
474 |
html += visualize_color_specific(theory_specific, primary_color)
|
475 |
else:
|
476 |
# ๊ธฐ๋ณธ ์ด๋ก ํน์ฑ ํ์
|
|
|
477 |
html += f"""
|
478 |
<div style="background: linear-gradient(135deg, {primary_color}15 0%, {primary_color}05 100%); padding: 25px; border-radius: 15px; margin-top: 20px;">
|
479 |
-
<h4 style="margin: 0 0 15px 0; color: {primary_color};"
|
480 |
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px;">
|
481 |
"""
|
482 |
for key, value in theory_specific.items():
|
@@ -493,9 +862,10 @@ def generate_unified_visualization(theory: str, results: List[Dict]) -> str:
|
|
493 |
"""
|
494 |
|
495 |
# ์ ์ฒด ํ๊ฐ
|
|
|
496 |
html += f"""
|
497 |
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px; margin-top: 20px;">
|
498 |
-
<h4 style="margin: 0 0 10px 0; color: {primary_color};"
|
499 |
<p style="margin: 0; color: #555; line-height: 1.6;">{evaluation.get('overall_effectiveness', 'N/A')}</p>
|
500 |
</div>
|
501 |
</div>
|
@@ -511,7 +881,7 @@ def visualize_square_specific(theory_specific: Dict, primary_color: str) -> str:
|
|
511 |
"""Square Theory ํน์ ์๊ฐํ"""
|
512 |
return f"""
|
513 |
<div style="background: #f8f9fa; padding: 30px; border-radius: 15px; margin-top: 20px;">
|
514 |
-
<h4 style="margin: 0 0 20px 0; color: {primary_color}; text-align: center;">Square
|
515 |
<div style="position: relative; width: 100%; max-width: 400px; height: 300px; margin: 0 auto;">
|
516 |
<div style="position: absolute; top: 0; left: 0; background: white; color: {primary_color}; padding: 15px 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); font-weight: bold;">
|
517 |
{theory_specific.get('tl', '?')}
|
@@ -547,7 +917,7 @@ def visualize_blending_specific(theory_specific: Dict, primary_color: str) -> st
|
|
547 |
"""Conceptual Blending ํน์ ์๊ฐํ"""
|
548 |
return f"""
|
549 |
<div style="background: #f8f9fa; padding: 30px; border-radius: 15px; margin-top: 20px;">
|
550 |
-
<h4 style="margin: 0 0 20px 0; color: {primary_color}; text-align: center;"
|
551 |
<div style="display: flex; justify-content: center; align-items: center; gap: 20px; flex-wrap: wrap;">
|
552 |
<div style="text-align: center; padding: 20px; background: white; color: {primary_color}; border-radius: 50%; width: 120px; height: 120px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
553 |
<div>
|
@@ -582,7 +952,7 @@ def visualize_color_specific(theory_specific: Dict, primary_color: str) -> str:
|
|
582 |
|
583 |
html = f"""
|
584 |
<div style="background: #f8f9fa; padding: 30px; border-radius: 15px; margin-top: 20px;">
|
585 |
-
<h4 style="margin: 0 0 20px 0; color: {primary_color}; text-align: center;"
|
586 |
<div style="display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;">
|
587 |
"""
|
588 |
|
@@ -600,24 +970,61 @@ def visualize_color_specific(theory_specific: Dict, primary_color: str) -> str:
|
|
600 |
|
601 |
# Gradio UI
|
602 |
with gr.Blocks(
|
603 |
-
title="
|
604 |
theme=gr.themes.Soft(),
|
605 |
css="""
|
606 |
.gradio-container {
|
607 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
608 |
}
|
609 |
.tab-nav button {
|
610 |
-
font-size: 0.
|
611 |
-
padding:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
612 |
}
|
613 |
"""
|
614 |
) as demo:
|
615 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
616 |
<div style="text-align: center; padding: 30px 0;">
|
617 |
-
<h1 style="font-size:
|
618 |
-
|
619 |
</h1>
|
620 |
-
<p style="font-size: 1.
|
|
|
621 |
</div>
|
622 |
""")
|
623 |
|
@@ -625,42 +1032,71 @@ with gr.Blocks(
|
|
625 |
with gr.Column(scale=1, min_width=300):
|
626 |
gr.Markdown("""
|
627 |
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px; margin-bottom: 20px;">
|
628 |
-
<h3 style="margin-top: 0;">๐
|
629 |
</div>
|
630 |
""")
|
631 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
632 |
industry_input = gr.Textbox(
|
633 |
-
label="๐ญ
|
634 |
-
placeholder="
|
635 |
-
value="
|
636 |
)
|
637 |
|
638 |
keywords_input = gr.Textbox(
|
639 |
-
label="๐
|
640 |
-
placeholder="
|
641 |
-
info="
|
642 |
lines=2
|
643 |
)
|
644 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
645 |
gr.Markdown("""
|
646 |
<div style="background: #e3f2fd; padding: 15px; border-radius: 8px; margin-top: 20px;">
|
647 |
-
<h4 style="margin-top: 0; color: #1976d2;"
|
648 |
-
<p style="margin: 10px 0;"
|
649 |
-
<ul style="margin: 5px 0; padding-left: 20px;">
|
650 |
-
<li><strong
|
651 |
-
<li><strong
|
652 |
-
<li><strong
|
653 |
-
<li><strong
|
654 |
-
<li><strong
|
655 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
656 |
</ul>
|
657 |
</div>
|
658 |
""")
|
659 |
|
660 |
with gr.Column(scale=3):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
661 |
# 15๊ฐ ํญ ์์ฑ
|
662 |
-
with gr.Tabs():
|
663 |
-
# ๊ฐ ์ด๋ก ๋ณ ํญ (์์๋ก ๋ช ๊ฐ๋ง ํ์)
|
664 |
theories = [
|
665 |
("๐ฆ Square Theory", "square"),
|
666 |
("๐ Conceptual Blending", "blending"),
|
@@ -681,35 +1117,85 @@ with gr.Blocks(
|
|
681 |
|
682 |
for tab_name, theory_key in theories:
|
683 |
with gr.Tab(tab_name):
|
684 |
-
with gr.
|
685 |
-
|
686 |
-
|
687 |
-
|
688 |
-
|
689 |
-
|
690 |
-
|
691 |
-
|
692 |
-
|
693 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
694 |
|
695 |
gr.Markdown("""
|
696 |
-
<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding:
|
697 |
-
<h3 style="margin-top: 0;"
|
698 |
-
<
|
699 |
-
|
700 |
-
|
701 |
-
<
|
702 |
-
|
|
|
|
|
|
|
703 |
</div>
|
704 |
-
<div>
|
705 |
-
<h4
|
706 |
-
<p style="margin:
|
707 |
</div>
|
708 |
-
<div>
|
709 |
-
<h4
|
710 |
-
<p style="margin:
|
711 |
</div>
|
712 |
</div>
|
|
|
|
|
|
|
|
|
|
|
|
|
713 |
</div>
|
714 |
""")
|
715 |
|
|
|
1 |
"""
|
2 |
+
THEORIAโข - Theory-driven Naming AI
|
3 |
+
===================================
|
4 |
+
ํน๋ณํ 15๊ฐ์ ์ด๋ก ์ผ๋ก ์์ฑํ๋ ๋ค์ด๋ฐ AI
|
5 |
+
Theory-driven Naming AI with 15 Specialized Theories
|
6 |
+
-----------------------------------
|
7 |
"""
|
8 |
|
9 |
import os
|
|
|
14 |
from datetime import datetime
|
15 |
from typing import List, Dict, Tuple, Optional
|
16 |
import random
|
17 |
+
import time
|
18 |
|
19 |
# OpenAI ํด๋ผ์ด์ธํธ
|
20 |
if not os.getenv("OPENAI_API_KEY"):
|
|
|
22 |
|
23 |
client = OpenAI()
|
24 |
|
25 |
+
# ์ธ์ด๋ณ ํ
์คํธ ์ ์
|
26 |
+
TEXTS = {
|
27 |
+
"en": {
|
28 |
+
"title": "THEORIAโข",
|
29 |
+
"subtitle": "Theory-driven Naming AI with 15 Specialized Theories",
|
30 |
+
"description": "Generate innovative brand names using 15 cognitive and creative theories",
|
31 |
+
"industry_label": "๐ญ Industry",
|
32 |
+
"industry_placeholder": "e.g., cafe, fitness, education, beauty...",
|
33 |
+
"keywords_label": "๐ Keywords",
|
34 |
+
"keywords_placeholder": "premium, comfortable, urban, eco-friendly...",
|
35 |
+
"keywords_info": "Core values or characteristics the brand should embody",
|
36 |
+
"generate_button": "Generate with {theory}",
|
37 |
+
"language_label": "๐ Language",
|
38 |
+
"progress_message": "Generating innovative names using {theory}...",
|
39 |
+
"error_message": "โ Error in {theory}: {error}",
|
40 |
+
"input_required": "โ ๏ธ Please enter both industry and keywords.",
|
41 |
+
"evaluation_labels": {
|
42 |
+
"creativity": "Creativity",
|
43 |
+
"memorability": "Memorability",
|
44 |
+
"relevance": "Relevance"
|
45 |
+
}
|
46 |
+
},
|
47 |
+
"ko": {
|
48 |
+
"title": "THEORIAโข",
|
49 |
+
"subtitle": "ํน๋ณํ 15๊ฐ์ ์ด๋ก ์ผ๋ก ์์ฑํ๋ ๋ค์ด๋ฐ AI",
|
50 |
+
"description": "15๊ฐ์ง ์ธ์ง ๋ฐ ์ฐฝ์ ์ด๋ก ์ ํ์ฉํ ํ์ ์ ์ธ ๋ธ๋๋๋ช
์์ฑ",
|
51 |
+
"industry_label": "๐ญ ์
์ข
",
|
52 |
+
"industry_placeholder": "์: ์นดํ, ํผํธ๋์ค, ๊ต์ก, ๋ทฐํฐ...",
|
53 |
+
"keywords_label": "๐ ํต์ฌ ํค์๋",
|
54 |
+
"keywords_placeholder": "ํ๋ฆฌ๋ฏธ์, ํธ์ํ, ๋์์ ์ธ, ์นํ๊ฒฝ...",
|
55 |
+
"keywords_info": "๋ธ๋๋๊ฐ ๋ด์์ผ ํ ํต์ฌ ๊ฐ์น๋ ํน์ง๋ค",
|
56 |
+
"generate_button": "{theory}๋ก ์์ฑ",
|
57 |
+
"language_label": "๐ ์ธ์ด",
|
58 |
+
"progress_message": "{theory}๋ฅผ ํ์ฉํด ํ์ ์ ์ธ ์ด๋ฆ์ ์์ฑํ๊ณ ์์ต๋๋ค...",
|
59 |
+
"error_message": "โ {theory} ์ค๋ฅ: {error}",
|
60 |
+
"input_required": "โ ๏ธ ์
์ข
๊ณผ ํค์๋๋ฅผ ๋ชจ๋ ์
๋ ฅํด์ฃผ์ธ์.",
|
61 |
+
"evaluation_labels": {
|
62 |
+
"creativity": "์ฐฝ์์ฑ",
|
63 |
+
"memorability": "๊ธฐ์ต์ฑ",
|
64 |
+
"relevance": "๊ด๋ จ์ฑ"
|
65 |
+
}
|
66 |
+
}
|
67 |
+
}
|
68 |
+
|
69 |
+
# ์ด๋ก ๋ณ ์ค๋ช
(์์ด/ํ๊ตญ์ด)
|
70 |
THEORY_DESCRIPTIONS = {
|
71 |
+
"en": {
|
72 |
+
"square": "Creates a semantic square structure where 4 words are connected by meaningful relationships. Hidden diagonal connections create 'aha!' moments.",
|
73 |
+
"blending": "Blends two or more concepts to create new meaning. Like Netflix (Net+Flix), it births innovative concepts.",
|
74 |
+
"sound": "Utilizes associations between phonemes and meaning. 'i,e' convey lightness and speed, 'o,u' convey weight and slowness.",
|
75 |
+
"linguistic": "Creates global brands considering linguistic thought differences. Reflects cultural nuances and localization strategies.",
|
76 |
+
"archetype": "Leverages Jung's 12 universal archetypes. Creates unconscious emotional connections like Hero (Nike) or Creator (Apple).",
|
77 |
+
"jobs": "Focuses on the 'job' customers are trying to get done. Integrates functional, emotional, and social needs.",
|
78 |
+
"scamper": "Uses 7 creative techniques (Substitute, Combine, Adapt, Modify, Put to other use, Eliminate, Reverse) for innovation.",
|
79 |
+
"design": "Pursues human-centered innovation. Finds the intersection of desirability (human), feasibility (technical), and viability (business).",
|
80 |
+
"biomimicry": "Creates nature-inspired brands. Applies 3.8 billion years of evolutionary wisdom to branding.",
|
81 |
+
"cognitive": "Creates brands that minimize cognitive processing. Uses 1-3 syllables for instant recognition and recall.",
|
82 |
+
"vonrestorff": "Creates unique, memorable brands. Intentionally violates category conventions for 30x better recall.",
|
83 |
+
"network": "Creates brands that maximize network value. Designs structures where value increases with more users.",
|
84 |
+
"memetics": "Creates culturally replicable and evolving brands. Embeds viral elements that spread naturally like memes.",
|
85 |
+
"color": "Creates brands using color associations and emotions. Applies color psychology: red (passion), blue (trust), green (nature).",
|
86 |
+
"gestalt": "Creates brands using perception principles. Designs holistic brand experiences where the whole exceeds the sum of parts."
|
87 |
+
},
|
88 |
+
"ko": {
|
89 |
+
"square": "4๊ฐ์ ๋จ์ด๊ฐ ์๋ฏธ์ ๊ด๊ณ๋ก ์ฐ๊ฒฐ๋์ด ์ฌ๊ฐํ์ ์ด๋ฃจ๋ ๊ตฌ์กฐ์
๋๋ค. ๋๋ณ์ ์จ๊ฒจ์ง ์ฐ๊ฒฐ์ด '์ํ!' ๋ชจ๋จผํธ๋ฅผ ๋ง๋ญ๋๋ค.",
|
90 |
+
"blending": "๋ ๊ฐ ์ด์์ ๊ฐ๋
์ ํผํฉํ์ฌ ์๋ก์ด ์๋ฏธ๋ฅผ ์ฐฝ์ถํฉ๋๋ค. Netflix(Net+Flix)์ฒ๋ผ ํ์ ์ ์ธ ๊ฐ๋
์ ํ์์ํต๋๋ค.",
|
91 |
+
"sound": "์์์ ์๋ฏธ ๊ฐ์ ์ฐ๊ด์ฑ์ ํ์ฉํฉ๋๋ค. 'i,e'๋ ๊ฐ๋ณ๊ณ ๋น ๋ฅธ ๋๋, 'o,u'๋ ๋ฌด๊ฒ๊ณ ๋๋ฆฐ ๋๋์ ์ ๋ฌํฉ๋๋ค.",
|
92 |
+
"linguistic": "์ธ์ด๋ณ ์ฌ๊ณ ๋ฐฉ์ ์ฐจ์ด๋ฅผ ๊ณ ๋ คํ ๊ธ๋ก๋ฒ ๋ธ๋๋๋ฅผ ๋ง๋ญ๋๋ค. ๋ฌธํ์ ๋์์ค์ ํ์งํ ์ ๋ต์ ๋ฐ์ํฉ๋๋ค.",
|
93 |
+
"archetype": "Jung์ 12๊ฐ์ง ๋ณดํธ์ ์ํ์ ํ์ฉํฉ๋๋ค. Hero(Nike), Creator(Apple)์ฒ๋ผ ๋ฌด์์์ ๊ฐ์ ์ฐ๊ฒฐ์ ๋ง๋ญ๋๋ค.",
|
94 |
+
"jobs": "๊ณ ๊ฐ์ด ํด๊ฒฐํ๋ ค๋ '์ผ'์ ์ด์ ์ ๋ง์ถฅ๋๋ค. ๊ธฐ๋ฅ์ , ๊ฐ์ ์ , ์ฌํ์ ์ฐจ์์ ๋์ฆ๋ฅผ ํตํฉ์ ์ผ๋ก ํด๊ฒฐํฉ๋๋ค.",
|
95 |
+
"scamper": "7๊ฐ์ง ์ฐฝ์์ ๊ธฐ๋ฒ(๋์ฒด, ๊ฒฐํฉ, ์ ์, ์์ , ์ฉ๋๋ณ๊ฒฝ, ์ ๊ฑฐ, ์ญ์ )์ผ๋ก ํ์ ์ ์ธ ๋ธ๋๋๋ฅผ ๋ง๋ญ๋๋ค.",
|
96 |
+
"design": "์ธ๊ฐ ์ค์ฌ ํ์ ์ ์ถ๊ตฌํฉ๋๋ค. ๋ฐ๋์งํจ(์ธ๊ฐ), ์คํ๊ฐ๋ฅ์ฑ(๊ธฐ์ ), ์์กด๊ฐ๋ฅ์ฑ(๋น์ฆ๋์ค)์ ๊ต์งํฉ์ ์ฐพ์ต๋๋ค.",
|
97 |
+
"biomimicry": "์์ฐ์์ ์๊ฐ์ ๋ฐ์ ๋ธ๋๋๋ฅผ ๋ง๋ญ๋๋ค. 38์ต๋
์งํ์ ์งํ๋ฅผ ๋ธ๋๋ฉ์ ์ ์ฉํฉ๋๋ค.",
|
98 |
+
"cognitive": "์ธ์ง ์ฒ๋ฆฌ๋ฅผ ์ต์ํํ๋ ๋ธ๋๋๋ฅผ ๋ง๋ญ๋๋ค. 1-3์์ ์ ์ฌ์ด ๋ฐ์์ผ๋ก ์ฆ๊ฐ์ ์ธ์๊ณผ ๊ธฐ์ต์ ๋์ต๋๋ค.",
|
99 |
+
"vonrestorff": "๋
ํนํ๊ณ ๊ธฐ์ต์ ๋จ๋ ๋ธ๋๋๋ฅผ ๋ง๋ญ๋๋ค. ์นดํ
๊ณ ๋ฆฌ ๊ด์ต์ ์๋์ ์ผ๋ก ์๋ฐํ์ฌ 30๋ฐฐ ๋ ์ ๊ธฐ์ต๋๊ฒ ํฉ๋๋ค.",
|
100 |
+
"network": "๋คํธ์ํฌ ๊ฐ์น๋ฅผ ๊ทน๋ํํ๋ ๋ธ๋๋๋ฅผ ๋ง๋ญ๋๋ค. ์ฌ์ฉ์๊ฐ ๋ง์์๋ก ๊ฐ์น๊ฐ ์ฆ๊ฐํ๋ ๊ตฌ์กฐ๋ฅผ ์ค๊ณํฉ๋๋ค.",
|
101 |
+
"memetics": "๋ฌธํ์ ์ผ๋ก ๋ณต์ ๋๊ณ ์งํํ๋ ๋ธ๋๋๋ฅผ ๋ง๋ญ๋๋ค. ๋ฐ์ฒ๋ผ ์์ฐ์ค๋ฝ๊ฒ ํผ์ ธ๋๊ฐ๋ ๋ฐ์ด๋ด ์์๋ฅผ ๋ด์ฌํํฉ๋๋ค.",
|
102 |
+
"color": "์์ ์ฐ์๊ณผ ๊ฐ์ ์ ํ์ฉํ ๋ธ๋๋๋ฅผ ๋ง๋ญ๋๋ค. ๋นจ๊ฐ(์ด์ ), ํ๋(์ ๋ขฐ), ์ด๋ก(์์ฐ) ๋ฑ ์์ ์ฌ๋ฆฌ๋ฅผ ์ ์ฉํฉ๋๋ค.",
|
103 |
+
"gestalt": "์ง๊ฐ ์๋ฆฌ๋ฅผ ํ์ฉํ ๋ธ๋๋๋ฅผ ๋ง๋ญ๋๋ค. ์ ์ฒด๊ฐ ๋ถ๋ถ์ ํฉ๋ณด๋ค ํฌ๋ค๋ ์์น์ผ๋ก ํตํฉ์ ๋ธ๋๋ ๊ฒฝํ์ ์ค๊ณํฉ๋๋ค."
|
104 |
+
}
|
105 |
}
|
106 |
|
107 |
+
# ํต์ผ๋ ๊ธฐ๋ณธ ๏ฟฝ๏ฟฝ๋กฌํํธ ํ
ํ๋ฆฟ (์์ด)
|
108 |
+
UNIFIED_BASE_PROMPT_EN = """
|
109 |
+
You are a {theory_name} expert. {theory_description}
|
110 |
+
|
111 |
+
Based on the user input (industry/keywords), generate an array in the following unified JSON format:
|
112 |
+
|
113 |
+
{{
|
114 |
+
"brands": [
|
115 |
+
{{
|
116 |
+
"core": {{
|
117 |
+
"brand_name": "Brand Name",
|
118 |
+
"slogan": "Slogan",
|
119 |
+
"core_value": "Core Value",
|
120 |
+
"target_emotion": "Target Emotion",
|
121 |
+
"brand_personality": "Brand Personality"
|
122 |
+
}},
|
123 |
+
"visual": {{
|
124 |
+
"primary_color": "#HEX",
|
125 |
+
"color_meaning": "Color Meaning",
|
126 |
+
"visual_concept": "Visual Concept",
|
127 |
+
"typography_style": "Typography Style"
|
128 |
+
}},
|
129 |
+
"linguistic": {{
|
130 |
+
"pronunciation": "Pronunciation Guide",
|
131 |
+
"etymology": "Etymology/Structure",
|
132 |
+
"global_adaptability": "Global Adaptability",
|
133 |
+
"memorable_factor": "Memorability Factor"
|
134 |
+
}},
|
135 |
+
"strategic": {{
|
136 |
+
"differentiation": "Differentiation Point",
|
137 |
+
"market_positioning": "Market Positioning",
|
138 |
+
"growth_potential": "Growth Potential",
|
139 |
+
"implementation_ease": "Implementation Ease"
|
140 |
+
}},
|
141 |
+
"theory_specific": {{
|
142 |
+
{theory_specific_fields}
|
143 |
+
}},
|
144 |
+
"evaluation": {{
|
145 |
+
"creativity_score": 0-10,
|
146 |
+
"memorability_score": 0-10,
|
147 |
+
"relevance_score": 0-10,
|
148 |
+
"overall_effectiveness": "Overall effectiveness description"
|
149 |
+
}}
|
150 |
+
}}
|
151 |
+
]
|
152 |
+
}}
|
153 |
+
|
154 |
+
Return valid JSON format and fill all fields.
|
155 |
+
Include theory-specific characteristics in the theory_specific section while maintaining the unified structure.
|
156 |
+
All content should be in English.
|
157 |
+
"""
|
158 |
+
|
159 |
+
# ํต์ผ๋ ๊ธฐ๋ณธ ํ๋กฌํํธ ํ
ํ๋ฆฟ (ํ๊ตญ์ด)
|
160 |
+
UNIFIED_BASE_PROMPT_KO = """
|
161 |
๋น์ ์ {theory_name} ์ ๋ฌธ๊ฐ์
๋๋ค. {theory_description}
|
162 |
|
163 |
์ฌ์ฉ์ ์
๋ ฅ(์
์ข
/ํค์๋)์ ๋ฐ์ ๋ค์๊ณผ ๊ฐ์ ํต์ผ๋ JSON ํ์์ ๋ฐฐ์ด์ ์์ฑํ์ธ์:
|
|
|
205 |
|
206 |
๋ฐ๋์ ์ ํจํ JSON ํ์์ผ๋ก ์๋ตํ๊ณ , ๋ชจ๋ ํ๋๋ฅผ ์ฑ์์ฃผ์ธ์.
|
207 |
๊ฐ ์ด๋ก ์ ํน์ฑ์ theory_specific ์น์
์ ๋ด๋, ๋๋จธ์ง๋ ํต์ผ๋ ๊ตฌ์กฐ๋ฅผ ์ ์งํ์ธ์.
|
208 |
+
๋ชจ๋ ๋ด์ฉ์ ํ๊ตญ์ด๋ก ์์ฑํ์ธ์.
|
209 |
"""
|
210 |
|
211 |
+
# ์ด๋ก ๋ณ ํน์ ํ๋ ์ ์ (์์ด)
|
212 |
+
THEORY_SPECIFIC_FIELDS_EN = {
|
213 |
+
"square": """
|
214 |
+
"tl": "Top Left",
|
215 |
+
"tr": "Top Right",
|
216 |
+
"bl": "Bottom Left",
|
217 |
+
"br": "Bottom Right",
|
218 |
+
"top_edge": "Top Relationship",
|
219 |
+
"bottom_edge": "Bottom Relationship",
|
220 |
+
"left_edge": "Left Relationship",
|
221 |
+
"right_edge": "Right Relationship",
|
222 |
+
"diagonal_insight": "Diagonal Insight"
|
223 |
+
""",
|
224 |
+
|
225 |
+
"blending": """
|
226 |
+
"input_space1": "First Concept",
|
227 |
+
"input_space2": "Second Concept",
|
228 |
+
"generic_space": "Common Structure",
|
229 |
+
"blended_space": "Blended New Meaning",
|
230 |
+
"emergent_properties": "Emergent Properties",
|
231 |
+
"blend_ratio": "Blend Ratio"
|
232 |
+
""",
|
233 |
+
|
234 |
+
"sound": """
|
235 |
+
"phonetic_analysis": "Phonetic Analysis",
|
236 |
+
"sound_meaning": "Sound Meaning",
|
237 |
+
"vowel_consonant_ratio": "Vowel/Consonant Ratio",
|
238 |
+
"phoneme_emotion_map": "Phoneme-Emotion Mapping",
|
239 |
+
"cross_linguistic_sound": "Cross-linguistic Sound Consistency"
|
240 |
+
""",
|
241 |
+
|
242 |
+
"linguistic": """
|
243 |
+
"korean_adaptation": "Korean Adaptation",
|
244 |
+
"english_meaning": "English Meaning",
|
245 |
+
"cultural_considerations": "Cultural Considerations",
|
246 |
+
"avoid_meanings": "Meanings to Avoid",
|
247 |
+
"localization_strategy": "Localization Strategy"
|
248 |
+
""",
|
249 |
+
|
250 |
+
"archetype": """
|
251 |
+
"archetype": "Selected Archetype",
|
252 |
+
"archetype_traits": "Archetype Traits",
|
253 |
+
"shadow_side": "Shadow Side",
|
254 |
+
"mythology_reference": "Mythological Reference",
|
255 |
+
"customer_journey": "Customer Journey Connection"
|
256 |
+
""",
|
257 |
+
|
258 |
+
"jobs": """
|
259 |
+
"functional_job": "Functional Job",
|
260 |
+
"emotional_job": "Emotional Job",
|
261 |
+
"social_job": "Social Job",
|
262 |
+
"job_statement": "Core Job Statement",
|
263 |
+
"outcome_metrics": "Outcome Metrics"
|
264 |
+
""",
|
265 |
+
|
266 |
+
"scamper": """
|
267 |
+
"scamper_technique": "Technique Used",
|
268 |
+
"original_concept": "Original Concept",
|
269 |
+
"transformation": "Transformation Process",
|
270 |
+
"innovation_type": "Innovation Type",
|
271 |
+
"disruption_level": "Disruption Level"
|
272 |
+
""",
|
273 |
+
|
274 |
+
"design": """
|
275 |
+
"user_insight": "User Insight",
|
276 |
+
"pain_point": "Pain Point Solved",
|
277 |
+
"desirability": "Desirability (Human)",
|
278 |
+
"feasibility": "Feasibility (Technical)",
|
279 |
+
"viability": "Viability (Business)"
|
280 |
+
""",
|
281 |
+
|
282 |
+
"biomimicry": """
|
283 |
+
"natural_inspiration": "Natural Inspiration",
|
284 |
+
"biomimetic_principle": "Biomimetic Principle",
|
285 |
+
"form_function": "Form and Function",
|
286 |
+
"sustainability_aspect": "Sustainability Aspect",
|
287 |
+
"adaptation_strategy": "Adaptation Strategy"
|
288 |
+
""",
|
289 |
+
|
290 |
+
"cognitive": """
|
291 |
+
"syllable_count": "Syllable Count",
|
292 |
+
"processing_ease": "Processing Ease Score",
|
293 |
+
"memory_hooks": "Memory Hooks",
|
294 |
+
"cognitive_fluency": "Cognitive Fluency",
|
295 |
+
"attention_span_fit": "Attention Span Fit"
|
296 |
+
""",
|
297 |
+
|
298 |
+
"vonrestorff": """
|
299 |
+
"category_norm": "Category Norm",
|
300 |
+
"deviation_strategy": "Deviation Strategy",
|
301 |
+
"uniqueness_factors": "Uniqueness Factors",
|
302 |
+
"attention_triggers": "Attention Triggers",
|
303 |
+
"isolation_effect": "Isolation Effect Usage"
|
304 |
+
""",
|
305 |
+
|
306 |
+
"network": """
|
307 |
+
"network_type": "Network Type",
|
308 |
+
"viral_coefficient": "Viral Coefficient",
|
309 |
+
"sharing_ease": "Sharing Ease",
|
310 |
+
"community_aspect": "Community Aspect",
|
311 |
+
"network_value": "Network Value"
|
312 |
+
""",
|
313 |
+
|
314 |
+
"memetics": """
|
315 |
+
"meme_structure": "Meme Structure",
|
316 |
+
"replication_ease": "Replication Ease",
|
317 |
+
"mutation_potential": "Mutation Potential",
|
318 |
+
"cultural_fitness": "Cultural Fitness",
|
319 |
+
"transmission_channels": "Transmission Channels"
|
320 |
+
""",
|
321 |
+
|
322 |
+
"color": """
|
323 |
+
"color_palette": "Color Palette",
|
324 |
+
"emotional_response": "Emotional Response",
|
325 |
+
"cultural_associations": "Cultural Associations",
|
326 |
+
"industry_alignment": "Industry Alignment",
|
327 |
+
"color_accessibility": "Color Accessibility"
|
328 |
+
""",
|
329 |
+
|
330 |
+
"gestalt": """
|
331 |
+
"gestalt_principle": "Principle Used",
|
332 |
+
"visual_structure": "Visual Structure",
|
333 |
+
"perceptual_grouping": "Perceptual Grouping",
|
334 |
+
"figure_ground": "Figure-Ground Relationship",
|
335 |
+
"closure_effect": "Closure Effect"
|
336 |
+
"""
|
337 |
+
}
|
338 |
+
|
339 |
+
# ์ด๋ก ๋ณ ํน์ ํ๋ ์ ์ (ํ๊ตญ์ด)
|
340 |
+
THEORY_SPECIFIC_FIELDS_KO = {
|
341 |
"square": """
|
342 |
"tl": "์ผ์ชฝ์๋จ",
|
343 |
"tr": "์ค๋ฅธ์ชฝ์๋จ",
|
|
|
464 |
"""
|
465 |
}
|
466 |
|
467 |
+
def create_theory_prompt(theory: str, language: str) -> str:
|
468 |
"""๊ฐ ์ด๋ก ๋ณ ํต์ผ๋ ํ๋กฌํํธ ์์ฑ"""
|
469 |
theory_names = {
|
470 |
+
"en": {
|
471 |
+
"square": "Square Theory",
|
472 |
+
"blending": "Conceptual Blending Theory",
|
473 |
+
"sound": "Sound Symbolism",
|
474 |
+
"linguistic": "Linguistic Relativity",
|
475 |
+
"archetype": "Jung's Archetype Theory",
|
476 |
+
"jobs": "Jobs-to-be-Done Theory",
|
477 |
+
"scamper": "SCAMPER Method",
|
478 |
+
"design": "IDEO's Design Thinking",
|
479 |
+
"biomimicry": "Biomimicry",
|
480 |
+
"cognitive": "Cognitive Load Theory",
|
481 |
+
"vonrestorff": "Von Restorff Effect",
|
482 |
+
"network": "Network Effects",
|
483 |
+
"memetics": "Memetics",
|
484 |
+
"color": "Color Psychology",
|
485 |
+
"gestalt": "Gestalt Theory"
|
486 |
+
},
|
487 |
+
"ko": {
|
488 |
+
"square": "Square Theory",
|
489 |
+
"blending": "Conceptual Blending Theory",
|
490 |
+
"sound": "Sound Symbolism",
|
491 |
+
"linguistic": "Linguistic Relativity",
|
492 |
+
"archetype": "Jung์ Archetype Theory",
|
493 |
+
"jobs": "Jobs-to-be-Done Theory",
|
494 |
+
"scamper": "SCAMPER Method",
|
495 |
+
"design": "IDEO์ Design Thinking",
|
496 |
+
"biomimicry": "Biomimicry",
|
497 |
+
"cognitive": "Cognitive Load Theory",
|
498 |
+
"vonrestorff": "Von Restorff Effect",
|
499 |
+
"network": "Network Effects",
|
500 |
+
"memetics": "Memetics",
|
501 |
+
"color": "Color Psychology",
|
502 |
+
"gestalt": "Gestalt Theory"
|
503 |
+
}
|
504 |
}
|
505 |
|
506 |
+
base_prompt = UNIFIED_BASE_PROMPT_EN if language == "en" else UNIFIED_BASE_PROMPT_KO
|
507 |
+
theory_specific_fields = THEORY_SPECIFIC_FIELDS_EN if language == "en" else THEORY_SPECIFIC_FIELDS_KO
|
508 |
+
|
509 |
+
return base_prompt.format(
|
510 |
+
theory_name=theory_names[language][theory],
|
511 |
+
theory_description=THEORY_DESCRIPTIONS[language][theory],
|
512 |
+
theory_specific_fields=theory_specific_fields[theory]
|
513 |
)
|
514 |
|
515 |
+
def generate_by_theory(industry: str, keywords: str, theory: str, language: str, count: int = 3) -> Tuple[str, str, gr.update]:
|
516 |
"""ํน์ ์ด๋ก ์ผ๋ก ๋ธ๋๋ ์์ฑ"""
|
517 |
|
518 |
+
texts = TEXTS[language]
|
519 |
+
|
520 |
if not industry or not keywords:
|
521 |
+
return texts["input_required"], "", gr.update(visible=False)
|
522 |
+
|
523 |
+
prompt = create_theory_prompt(theory, language)
|
524 |
|
525 |
+
if language == "en":
|
526 |
+
user_input = f"""Industry: {industry}
|
527 |
+
Keywords: {keywords}
|
528 |
+
|
529 |
+
Generate {count} brands with the above information.
|
530 |
+
Each brand should have a unified structure, with theory-specific characteristics in the theory_specific section."""
|
531 |
+
else:
|
532 |
+
user_input = f"""์
์ข
: {industry}
|
533 |
ํค์๋: {keywords}
|
534 |
|
535 |
์ ์ ๋ณด๋ก {count}๊ฐ์ ๋ธ๋๋๋ฅผ ์์ฑํ์ธ์.
|
536 |
๊ฐ ๋ธ๋๋๋ ํต์ผ๋ ๊ตฌ์กฐ๋ฅผ ๊ฐ์ง๋, theory_specific ์น์
์๋ {theory} ์ด๋ก ์ ํน์ฑ์ ๋ฐ์ํ์ธ์."""
|
537 |
|
538 |
try:
|
539 |
+
# ํ๋ก๊ทธ๋ ์ค๋ฐ ํ์
|
540 |
+
theory_names = {
|
541 |
+
"square": "Square Theory",
|
542 |
+
"blending": "Conceptual Blending",
|
543 |
+
"sound": "Sound Symbolism",
|
544 |
+
"linguistic": "Linguistic Relativity",
|
545 |
+
"archetype": "Archetype Theory",
|
546 |
+
"jobs": "Jobs-to-be-Done",
|
547 |
+
"scamper": "SCAMPER Method",
|
548 |
+
"design": "Design Thinking",
|
549 |
+
"biomimicry": "Biomimicry",
|
550 |
+
"cognitive": "Cognitive Load Theory",
|
551 |
+
"vonrestorff": "Von Restorff Effect",
|
552 |
+
"network": "Network Effects",
|
553 |
+
"memetics": "Memetics",
|
554 |
+
"color": "Color Psychology",
|
555 |
+
"gestalt": "Gestalt Principles"
|
556 |
+
}
|
557 |
+
|
558 |
response = client.chat.completions.create(
|
559 |
model="gpt-4o-mini",
|
560 |
messages=[
|
|
|
579 |
results = [results]
|
580 |
|
581 |
# ๋งํฌ๋ค์ด ์์ฑ
|
582 |
+
markdown = generate_unified_markdown(theory, results, industry, keywords, language)
|
583 |
|
584 |
# HTML ์๊ฐํ ์์ฑ
|
585 |
+
html = generate_unified_visualization(theory, results, language)
|
586 |
|
587 |
+
return markdown, html, gr.update(visible=False)
|
588 |
|
589 |
except Exception as e:
|
590 |
+
error_msg = texts["error_message"].format(theory=theory_names[theory], error=str(e))
|
591 |
print(error_msg)
|
592 |
+
return error_msg, "", gr.update(visible=False)
|
593 |
|
594 |
+
def generate_unified_markdown(theory: str, results: List[Dict], industry: str, keywords: str, language: str) -> str:
|
595 |
"""ํต์ผ๋ ๋งํฌ๋ค์ด ์์ฑ"""
|
596 |
|
597 |
theory_names = {
|
|
|
619 |
"memetics": "๐งฌ", "color": "๐จ", "gestalt": "๐๏ธ"
|
620 |
}
|
621 |
|
622 |
+
texts = TEXTS[language]
|
623 |
+
|
624 |
+
if language == "en":
|
625 |
+
markdown = f"""# {theory_icons[theory]} {theory_names[theory]}
|
626 |
+
|
627 |
+
<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 20px; border-radius: 10px; margin-bottom: 20px;">
|
628 |
+
<h3 style="margin: 0 0 10px 0;">Theory Overview</h3>
|
629 |
+
<p style="margin: 0; line-height: 1.6;">{THEORY_DESCRIPTIONS[language][theory]}</p>
|
630 |
+
</div>
|
631 |
+
|
632 |
+
**Industry**: {industry} | **Keywords**: {keywords}
|
633 |
+
*Generated: {datetime.now().strftime('%Y-%m-%d %H:%M:%S')}*
|
634 |
+
|
635 |
+
---
|
636 |
+
"""
|
637 |
+
else:
|
638 |
+
markdown = f"""# {theory_icons[theory]} {theory_names[theory]}
|
639 |
|
640 |
<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 20px; border-radius: 10px; margin-bottom: 20px;">
|
641 |
<h3 style="margin: 0 0 10px 0;">์ด๋ก ๊ฐ์</h3>
|
642 |
+
<p style="margin: 0; line-height: 1.6;">{THEORY_DESCRIPTIONS[language][theory]}</p>
|
643 |
</div>
|
644 |
|
645 |
**์
์ข
**: {industry} | **ํค์๋**: {keywords}
|
|
|
660 |
slogan = core.get('slogan', 'N/A')
|
661 |
|
662 |
markdown += f"\n## {idx}. {brand_name}\n"
|
|
|
663 |
|
664 |
+
if language == "en":
|
665 |
+
markdown += f"""**Slogan**: *"{slogan}"*
|
666 |
+
|
667 |
+
### ๐ Core Information
|
668 |
+
- **Core Value**: {core.get('core_value', 'N/A')}
|
669 |
+
- **Target Emotion**: {core.get('target_emotion', 'N/A')}
|
670 |
+
- **Brand Personality**: {core.get('brand_personality', 'N/A')}
|
671 |
+
|
672 |
+
### ๐จ Visual Concept
|
673 |
+
- **Primary Color**: {visual.get('primary_color', '#000000')} - {visual.get('color_meaning', 'N/A')}
|
674 |
+
- **Visual Concept**: {visual.get('visual_concept', 'N/A')}
|
675 |
+
- **Typography**: {visual.get('typography_style', 'N/A')}
|
676 |
+
|
677 |
+
### ๐ฃ๏ธ Linguistic Features
|
678 |
+
- **Pronunciation**: {linguistic.get('pronunciation', 'N/A')}
|
679 |
+
- **Etymology**: {linguistic.get('etymology', 'N/A')}
|
680 |
+
- **Global Adaptability**: {linguistic.get('global_adaptability', 'N/A')}
|
681 |
+
|
682 |
+
### ๐ฏ Strategic Value
|
683 |
+
- **Differentiation**: {strategic.get('differentiation', 'N/A')}
|
684 |
+
- **Market Positioning**: {strategic.get('market_positioning', 'N/A')}
|
685 |
+
- **Growth Potential**: {strategic.get('growth_potential', 'N/A')}
|
686 |
+
"""
|
687 |
+
else:
|
688 |
+
markdown += f"""**์ฌ๋ก๊ฑด**: *"{slogan}"*
|
689 |
+
|
690 |
+
### ๐ ํต์ฌ ์ ๋ณด
|
691 |
- **ํต์ฌ ๊ฐ์น**: {core.get('core_value', 'N/A')}
|
692 |
- **๋ชฉํ ๊ฐ์ **: {core.get('target_emotion', 'N/A')}
|
693 |
- **๋ธ๋๋ ์ฑ๊ฒฉ**: {core.get('brand_personality', 'N/A')}
|
|
|
710 |
|
711 |
# ์ด๋ก ๋ณ ํน์ ์ ๋ณด
|
712 |
if theory_specific:
|
713 |
+
theory_header = f"### ๐ก {theory_names[theory]} " + ("Features" if language == "en" else "ํน์ฑ") + "\n"
|
714 |
+
markdown += theory_header
|
715 |
for key, value in theory_specific.items():
|
|
|
716 |
display_key = key.replace('_', ' ').title()
|
717 |
markdown += f"- **{display_key}**: {value}\n"
|
718 |
|
719 |
# ํ๊ฐ ์ ์
|
720 |
+
eval_labels = texts["evaluation_labels"]
|
721 |
+
|
722 |
+
if language == "en":
|
723 |
+
markdown += f"""
|
724 |
+
### ๐ Evaluation
|
725 |
+
- **{eval_labels['creativity']}**: {'โญ' * int(evaluation.get('creativity_score', 0))} ({evaluation.get('creativity_score', 0)}/10)
|
726 |
+
- **{eval_labels['memorability']}**: {'โญ' * int(evaluation.get('memorability_score', 0))} ({evaluation.get('memorability_score', 0)}/10)
|
727 |
+
- **{eval_labels['relevance']}**: {'โญ' * int(evaluation.get('relevance_score', 0))} ({evaluation.get('relevance_score', 0)}/10)
|
728 |
+
|
729 |
+
๐ฌ **Overall Assessment**: {evaluation.get('overall_effectiveness', 'N/A')}
|
730 |
+
"""
|
731 |
+
else:
|
732 |
+
markdown += f"""
|
733 |
### ๐ ํ๊ฐ
|
734 |
+
- **{eval_labels['creativity']}**: {'โญ' * int(evaluation.get('creativity_score', 0))} ({evaluation.get('creativity_score', 0)}/10)
|
735 |
+
- **{eval_labels['memorability']}**: {'โญ' * int(evaluation.get('memorability_score', 0))} ({evaluation.get('memorability_score', 0)}/10)
|
736 |
+
- **{eval_labels['relevance']}**: {'โญ' * int(evaluation.get('relevance_score', 0))} ({evaluation.get('relevance_score', 0)}/10)
|
737 |
|
738 |
๐ฌ **์ ์ฒด ํ๊ฐ**: {evaluation.get('overall_effectiveness', 'N/A')}
|
739 |
"""
|
|
|
742 |
|
743 |
return markdown
|
744 |
|
745 |
+
def generate_unified_visualization(theory: str, results: List[Dict], language: str) -> str:
|
746 |
"""ํต์ผ๋ ์๊ฐํ ์์ฑ"""
|
747 |
|
748 |
+
texts = TEXTS[language]
|
749 |
+
eval_labels = texts["evaluation_labels"]
|
750 |
+
|
751 |
html_parts = []
|
752 |
|
753 |
for idx, result in enumerate(results, 1):
|
|
|
762 |
slogan = core.get('slogan', '')
|
763 |
primary_color = visual.get('primary_color', '#667eea')
|
764 |
|
765 |
+
# ์ธ์ด๋ณ ๋ผ๋ฒจ
|
766 |
+
if language == "en":
|
767 |
+
labels = {
|
768 |
+
"core_value": "Core Value",
|
769 |
+
"target_emotion": "Target Emotion",
|
770 |
+
"differentiation": "Differentiation",
|
771 |
+
"pronunciation": "Pronunciation"
|
772 |
+
}
|
773 |
+
else:
|
774 |
+
labels = {
|
775 |
+
"core_value": "ํต์ฌ ๊ฐ์น",
|
776 |
+
"target_emotion": "๋ชฉํ ๊ฐ์ ",
|
777 |
+
"differentiation": "์ฐจ๋ณํ ํฌ์ธํธ",
|
778 |
+
"pronunciation": "๋ฐ์ ๊ฐ์ด๋"
|
779 |
+
}
|
780 |
+
|
781 |
# ํต์ผ๋ ์นด๋ ๋ ์ด์์
|
782 |
html = f"""
|
783 |
<div style="max-width: 800px; margin: 30px auto; font-family: -apple-system, sans-serif;">
|
|
|
796 |
<div style="font-size: 2em; color: {primary_color}; font-weight: bold;">
|
797 |
{evaluation.get('creativity_score', 0)}/10
|
798 |
</div>
|
799 |
+
<div style="color: #7f8c8d; margin-top: 5px;">{eval_labels['creativity']}</div>
|
800 |
</div>
|
801 |
<div style="text-align: center;">
|
802 |
<div style="font-size: 2em; color: {primary_color}; font-weight: bold;">
|
803 |
{evaluation.get('memorability_score', 0)}/10
|
804 |
</div>
|
805 |
+
<div style="color: #7f8c8d; margin-top: 5px;">{eval_labels['memorability']}</div>
|
806 |
</div>
|
807 |
<div style="text-align: center;">
|
808 |
<div style="font-size: 2em; color: {primary_color}; font-weight: bold;">
|
809 |
{evaluation.get('relevance_score', 0)}/10
|
810 |
</div>
|
811 |
+
<div style="color: #7f8c8d; margin-top: 5px;">{eval_labels['relevance']}</div>
|
812 |
</div>
|
813 |
</div>
|
814 |
|
815 |
<!-- ํต์ฌ ์ ๋ณด ๊ทธ๋ฆฌ๋ -->
|
816 |
<div style="display: grid; grid-template-columns: repeat(2, 1fr); gap: 20px; margin-bottom: 30px;">
|
817 |
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px;">
|
818 |
+
<h4 style="margin: 0 0 10px 0; color: {primary_color};">{labels['core_value']}</h4>
|
819 |
<p style="margin: 0; color: #555;">{core.get('core_value', 'N/A')}</p>
|
820 |
</div>
|
821 |
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px;">
|
822 |
+
<h4 style="margin: 0 0 10px 0; color: {primary_color};">{labels['target_emotion']}</h4>
|
823 |
<p style="margin: 0; color: #555;">{core.get('target_emotion', 'N/A')}</p>
|
824 |
</div>
|
825 |
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px;">
|
826 |
+
<h4 style="margin: 0 0 10px 0; color: {primary_color};">{labels['differentiation']}</h4>
|
827 |
<p style="margin: 0; color: #555;">{strategic.get('differentiation', 'N/A')}</p>
|
828 |
</div>
|
829 |
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px;">
|
830 |
+
<h4 style="margin: 0 0 10px 0; color: {primary_color};">{labels['pronunciation']}</h4>
|
831 |
<p style="margin: 0; color: #555;">{linguistic.get('pronunciation', 'N/A')}</p>
|
832 |
</div>
|
833 |
</div>
|
|
|
842 |
html += visualize_color_specific(theory_specific, primary_color)
|
843 |
else:
|
844 |
# ๊ธฐ๋ณธ ์ด๋ก ํน์ฑ ํ์
|
845 |
+
theory_header = "Theory Features" if language == "en" else "์ด๋ก ํน์ฑ"
|
846 |
html += f"""
|
847 |
<div style="background: linear-gradient(135deg, {primary_color}15 0%, {primary_color}05 100%); padding: 25px; border-radius: 15px; margin-top: 20px;">
|
848 |
+
<h4 style="margin: 0 0 15px 0; color: {primary_color};">{theory_header}</h4>
|
849 |
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 15px;">
|
850 |
"""
|
851 |
for key, value in theory_specific.items():
|
|
|
862 |
"""
|
863 |
|
864 |
# ์ ์ฒด ํ๊ฐ
|
865 |
+
overall_header = "Overall Assessment" if language == "en" else "์ ์ฒด ํ๊ฐ"
|
866 |
html += f"""
|
867 |
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px; margin-top: 20px;">
|
868 |
+
<h4 style="margin: 0 0 10px 0; color: {primary_color};">{overall_header}</h4>
|
869 |
<p style="margin: 0; color: #555; line-height: 1.6;">{evaluation.get('overall_effectiveness', 'N/A')}</p>
|
870 |
</div>
|
871 |
</div>
|
|
|
881 |
"""Square Theory ํน์ ์๊ฐํ"""
|
882 |
return f"""
|
883 |
<div style="background: #f8f9fa; padding: 30px; border-radius: 15px; margin-top: 20px;">
|
884 |
+
<h4 style="margin: 0 0 20px 0; color: {primary_color}; text-align: center;">Square Structure</h4>
|
885 |
<div style="position: relative; width: 100%; max-width: 400px; height: 300px; margin: 0 auto;">
|
886 |
<div style="position: absolute; top: 0; left: 0; background: white; color: {primary_color}; padding: 15px 20px; border-radius: 8px; box-shadow: 0 2px 10px rgba(0,0,0,0.1); font-weight: bold;">
|
887 |
{theory_specific.get('tl', '?')}
|
|
|
917 |
"""Conceptual Blending ํน์ ์๊ฐํ"""
|
918 |
return f"""
|
919 |
<div style="background: #f8f9fa; padding: 30px; border-radius: 15px; margin-top: 20px;">
|
920 |
+
<h4 style="margin: 0 0 20px 0; color: {primary_color}; text-align: center;">Concept Blending</h4>
|
921 |
<div style="display: flex; justify-content: center; align-items: center; gap: 20px; flex-wrap: wrap;">
|
922 |
<div style="text-align: center; padding: 20px; background: white; color: {primary_color}; border-radius: 50%; width: 120px; height: 120px; display: flex; align-items: center; justify-content: center; box-shadow: 0 2px 10px rgba(0,0,0,0.1);">
|
923 |
<div>
|
|
|
952 |
|
953 |
html = f"""
|
954 |
<div style="background: #f8f9fa; padding: 30px; border-radius: 15px; margin-top: 20px;">
|
955 |
+
<h4 style="margin: 0 0 20px 0; color: {primary_color}; text-align: center;">Color Palette</h4>
|
956 |
<div style="display: flex; justify-content: center; gap: 10px; flex-wrap: wrap;">
|
957 |
"""
|
958 |
|
|
|
970 |
|
971 |
# Gradio UI
|
972 |
with gr.Blocks(
|
973 |
+
title="THEORIAโข - Theory-driven Naming AI",
|
974 |
theme=gr.themes.Soft(),
|
975 |
css="""
|
976 |
.gradio-container {
|
977 |
font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
|
978 |
}
|
979 |
.tab-nav button {
|
980 |
+
font-size: 0.85em !important;
|
981 |
+
padding: 8px 12px !important;
|
982 |
+
white-space: nowrap !important;
|
983 |
+
}
|
984 |
+
.tab-nav {
|
985 |
+
flex-wrap: wrap !important;
|
986 |
+
gap: 5px !important;
|
987 |
+
}
|
988 |
+
@keyframes pulse {
|
989 |
+
0% { opacity: 0.6; }
|
990 |
+
50% { opacity: 1; }
|
991 |
+
100% { opacity: 0.6; }
|
992 |
+
}
|
993 |
+
.progress-bar {
|
994 |
+
animation: pulse 1.5s ease-in-out infinite;
|
995 |
}
|
996 |
"""
|
997 |
) as demo:
|
998 |
+
# ์ธ์ด ์ํ ๊ด๋ฆฌ
|
999 |
+
current_language = gr.State(value="en")
|
1000 |
+
|
1001 |
+
def update_ui_language(language):
|
1002 |
+
"""UI ์ธ์ด ์
๋ฐ์ดํธ"""
|
1003 |
+
texts = TEXTS[language]
|
1004 |
+
return (
|
1005 |
+
language, # current_language state update
|
1006 |
+
# Title section update
|
1007 |
+
gr.update(value=f"""
|
1008 |
+
<div style="text-align: center; padding: 30px 0;">
|
1009 |
+
<h1 style="font-size: 3em; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 10px;">
|
1010 |
+
{texts['title']}
|
1011 |
+
</h1>
|
1012 |
+
<p style="font-size: 1.4em; color: #7f8c8d; font-weight: 500;">{texts['subtitle']}</p>
|
1013 |
+
<p style="font-size: 1.1em; color: #95a5a6; margin-top: 10px;">{texts['description']}</p>
|
1014 |
+
</div>
|
1015 |
+
"""),
|
1016 |
+
gr.update(label=texts['industry_label'], placeholder=texts['industry_placeholder']),
|
1017 |
+
gr.update(label=texts['keywords_label'], placeholder=texts['keywords_placeholder'], info=texts['keywords_info']),
|
1018 |
+
)
|
1019 |
+
|
1020 |
+
# ํค๋
|
1021 |
+
title_section = gr.Markdown("""
|
1022 |
<div style="text-align: center; padding: 30px 0;">
|
1023 |
+
<h1 style="font-size: 3em; background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); -webkit-background-clip: text; -webkit-text-fill-color: transparent; margin-bottom: 10px;">
|
1024 |
+
THEORIAโข
|
1025 |
</h1>
|
1026 |
+
<p style="font-size: 1.4em; color: #7f8c8d; font-weight: 500;">Theory-driven Naming AI with 15 Specialized Theories</p>
|
1027 |
+
<p style="font-size: 1.1em; color: #95a5a6; margin-top: 10px;">Generate innovative brand names using 15 cognitive and creative theories</p>
|
1028 |
</div>
|
1029 |
""")
|
1030 |
|
|
|
1032 |
with gr.Column(scale=1, min_width=300):
|
1033 |
gr.Markdown("""
|
1034 |
<div style="background: #f8f9fa; padding: 20px; border-radius: 10px; margin-bottom: 20px;">
|
1035 |
+
<h3 style="margin-top: 0; color: #2c3e50;">๐ Brand Information</h3>
|
1036 |
</div>
|
1037 |
""")
|
1038 |
|
1039 |
+
# ์ธ์ด ์ ํ
|
1040 |
+
language_selector = gr.Radio(
|
1041 |
+
choices=[("English", "en"), ("ํ๊ตญ์ด", "ko")],
|
1042 |
+
value="en",
|
1043 |
+
label="๐ Language",
|
1044 |
+
info="Select output language"
|
1045 |
+
)
|
1046 |
+
|
1047 |
industry_input = gr.Textbox(
|
1048 |
+
label="๐ญ Industry",
|
1049 |
+
placeholder="e.g., cafe, fitness, education, beauty...",
|
1050 |
+
value=""
|
1051 |
)
|
1052 |
|
1053 |
keywords_input = gr.Textbox(
|
1054 |
+
label="๐ Keywords",
|
1055 |
+
placeholder="premium, comfortable, urban, eco-friendly...",
|
1056 |
+
info="Core values or characteristics the brand should embody",
|
1057 |
lines=2
|
1058 |
)
|
1059 |
|
1060 |
+
# ์ธ์ด ๋ณ๊ฒฝ ์ด๋ฒคํธ
|
1061 |
+
language_selector.change(
|
1062 |
+
update_ui_language,
|
1063 |
+
inputs=[language_selector],
|
1064 |
+
outputs=[current_language, title_section, industry_input, keywords_input]
|
1065 |
+
)
|
1066 |
+
|
1067 |
gr.Markdown("""
|
1068 |
<div style="background: #e3f2fd; padding: 15px; border-radius: 8px; margin-top: 20px;">
|
1069 |
+
<h4 style="margin-top: 0; color: #1976d2;">๐ฏ 15 Specialized Theories</h4>
|
1070 |
+
<p style="margin: 10px 0; font-size: 0.9em;">Each theory offers a unique approach to brand naming:</p>
|
1071 |
+
<ul style="margin: 5px 0; padding-left: 20px; font-size: 0.85em;">
|
1072 |
+
<li><strong>Cognitive</strong>: Square, Sound, Cognitive Load, Gestalt</li>
|
1073 |
+
<li><strong>Creative</strong>: Blending, SCAMPER, Biomimicry</li>
|
1074 |
+
<li><strong>Strategic</strong>: Jobs-to-be-Done, Design Thinking</li>
|
1075 |
+
<li><strong>Cultural</strong>: Archetype, Linguistic, Memetics</li>
|
1076 |
+
<li><strong>Distinctive</strong>: Von Restorff, Color, Network</li>
|
1077 |
+
</ul>
|
1078 |
+
</div>
|
1079 |
+
|
1080 |
+
<div style="background: #fff3cd; padding: 15px; border-radius: 8px; margin-top: 15px;">
|
1081 |
+
<h4 style="margin-top: 0; color: #856404;">๐ก Pro Tips</h4>
|
1082 |
+
<ul style="margin: 5px 0; padding-left: 20px; font-size: 0.85em;">
|
1083 |
+
<li>Try multiple theories to find the perfect fit</li>
|
1084 |
+
<li>Compare results across different approaches</li>
|
1085 |
+
<li>Combine insights from various theories</li>
|
1086 |
</ul>
|
1087 |
</div>
|
1088 |
""")
|
1089 |
|
1090 |
with gr.Column(scale=3):
|
1091 |
+
# 15๊ฐ ํญ์ 3๊ฐ ํ์ผ๋ก ๊ตฌ์ฑ
|
1092 |
+
gr.Markdown("""
|
1093 |
+
<div style="background: #f8f9fa; padding: 15px; border-radius: 10px; margin-bottom: 20px;">
|
1094 |
+
<h3 style="margin: 0; color: #2c3e50; text-align: center;">Select a Theory to Generate Names</h3>
|
1095 |
+
</div>
|
1096 |
+
""")
|
1097 |
+
|
1098 |
# 15๊ฐ ํญ ์์ฑ
|
1099 |
+
with gr.Tabs(elem_classes="tab-nav"):
|
|
|
1100 |
theories = [
|
1101 |
("๐ฆ Square Theory", "square"),
|
1102 |
("๐ Conceptual Blending", "blending"),
|
|
|
1117 |
|
1118 |
for tab_name, theory_key in theories:
|
1119 |
with gr.Tab(tab_name):
|
1120 |
+
with gr.Column():
|
1121 |
+
# ํ๋ก๊ทธ๋ ์ค ๋ฉ์์ง
|
1122 |
+
progress_msg = gr.Markdown(
|
1123 |
+
visible=False,
|
1124 |
+
value=f"""
|
1125 |
+
<div style="text-align: center; padding: 20px; background: #f0f8ff; border-radius: 10px; margin: 10px 0;">
|
1126 |
+
<div class="progress-bar" style="font-size: 1.2em; color: #1976d2;">
|
1127 |
+
Generating innovative names using {tab_name}...
|
1128 |
+
</div>
|
1129 |
+
<div style="margin-top: 10px;">
|
1130 |
+
<div style="width: 100%; background: #e0e0e0; border-radius: 5px; overflow: hidden;">
|
1131 |
+
<div style="width: 100%; height: 4px; background: linear-gradient(90deg, #1976d2 0%, #42a5f5 50%, #1976d2 100%); animation: slide 1.5s linear infinite;"></div>
|
1132 |
+
</div>
|
1133 |
+
</div>
|
1134 |
+
</div>
|
1135 |
+
<style>
|
1136 |
+
@keyframes slide {
|
1137 |
+
0% { transform: translateX(-100%); }
|
1138 |
+
100% { transform: translateX(100%); }
|
1139 |
+
}
|
1140 |
+
</style>
|
1141 |
+
"""
|
1142 |
+
)
|
1143 |
+
|
1144 |
+
with gr.Row():
|
1145 |
+
btn = gr.Button(
|
1146 |
+
f"Generate with {tab_name}",
|
1147 |
+
variant="primary",
|
1148 |
+
size="lg",
|
1149 |
+
elem_id=f"btn_{theory_key}"
|
1150 |
+
)
|
1151 |
+
|
1152 |
+
output = gr.Markdown()
|
1153 |
+
visual = gr.HTML()
|
1154 |
+
|
1155 |
+
def generate_with_progress(industry, keywords, theory, language):
|
1156 |
+
"""ํ๋ก๊ทธ๋ ์ค๋ฐ์ ํจ๊ป ์์ฑ"""
|
1157 |
+
# ๋จผ์ ํ๋ก๊ทธ๋ ์ค๋ฐ ํ์
|
1158 |
+
yield "", "", gr.update(visible=True)
|
1159 |
+
|
1160 |
+
# ์ค์ ์์ฑ ์์
|
1161 |
+
result_md, result_html, _ = generate_by_theory(industry, keywords, theory, language)
|
1162 |
+
|
1163 |
+
# ๊ฒฐ๊ณผ ๋ฐํ ๋ฐ ํ๋ก๊ทธ๋ ์ค๋ฐ ์จ๊น
|
1164 |
+
yield result_md, result_html, gr.update(visible=False)
|
1165 |
+
|
1166 |
+
btn.click(
|
1167 |
+
lambda i, k, l, t=theory_key: generate_with_progress(i, k, t, l),
|
1168 |
+
inputs=[industry_input, keywords_input, current_language],
|
1169 |
+
outputs=[output, visual, progress_msg]
|
1170 |
+
)
|
1171 |
|
1172 |
gr.Markdown("""
|
1173 |
+
<div style="background: linear-gradient(135deg, #667eea 0%, #764ba2 100%); color: white; padding: 40px; border-radius: 15px; margin-top: 40px;">
|
1174 |
+
<h3 style="margin-top: 0; text-align: center;">๐ Why THEORIAโข?</h3>
|
1175 |
+
<div style="display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 25px; margin-top: 25px;">
|
1176 |
+
<div style="background: rgba(255,255,255,0.1); padding: 20px; border-radius: 10px;">
|
1177 |
+
<h4 style="margin: 0 0 10px 0;">๐งช Scientific Foundation</h4>
|
1178 |
+
<p style="margin: 0; font-size: 0.95em;">Based on proven cognitive and creative theories from psychology, linguistics, and design</p>
|
1179 |
+
</div>
|
1180 |
+
<div style="background: rgba(255,255,255,0.1); padding: 20px; border-radius: 10px;">
|
1181 |
+
<h4 style="margin: 0 0 10px 0;">๐ฏ Multi-dimensional Approach</h4>
|
1182 |
+
<p style="margin: 0; font-size: 0.95em;">15 different perspectives ensure you find the perfect name for your brand</p>
|
1183 |
</div>
|
1184 |
+
<div style="background: rgba(255,255,255,0.1); padding: 20px; border-radius: 10px;">
|
1185 |
+
<h4 style="margin: 0 0 10px 0;">๐ Unified Evaluation</h4>
|
1186 |
+
<p style="margin: 0; font-size: 0.95em;">Consistent scoring system allows easy comparison across all theories</p>
|
1187 |
</div>
|
1188 |
+
<div style="background: rgba(255,255,255,0.1); padding: 20px; border-radius: 10px;">
|
1189 |
+
<h4 style="margin: 0 0 10px 0;">๐ Global Ready</h4>
|
1190 |
+
<p style="margin: 0; font-size: 0.95em;">Multilingual support and cultural considerations built into every theory</p>
|
1191 |
</div>
|
1192 |
</div>
|
1193 |
+
|
1194 |
+
<div style="text-align: center; margin-top: 30px; padding-top: 20px; border-top: 1px solid rgba(255,255,255,0.2);">
|
1195 |
+
<p style="margin: 0; font-size: 0.9em; opacity: 0.8;">
|
1196 |
+
THEORIAโข - Where Science Meets Creativity in Brand Naming
|
1197 |
+
</p>
|
1198 |
+
</div>
|
1199 |
</div>
|
1200 |
""")
|
1201 |
|