aliceblue11 commited on
Commit
3ea1518
·
verified ·
1 Parent(s): aa1a9f0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +198 -24
app.py CHANGED
@@ -2,32 +2,206 @@ import gradio as gr
2
  from datetime import datetime
3
 
4
  def analyze_concepts(month):
5
- """간단한 월별 컨셉 분석"""
6
-
7
- concepts = {
8
- "1월": ["신년 다짐 이벤트", "겨울 감성 이벤트", "새해 소망 이벤트"],
9
- "2월": ["밸런타인 이벤트", "사랑 고백 이벤트", "겨울 마무리 이벤트"],
10
- "3월": ["봄맞이 이벤트", "새학기 이벤트", "벚꽃 축제 이벤트"],
11
- "4월": ["꽃구경 이벤트", "봄나들이 이벤트", "새싹 키우기 이벤트"],
12
- "5월": ["가정의 달 이벤트", "어린이날 이벤트", "어버이날 이벤트"],
13
- "6월": ["여름준비 이벤트", "현충일 추모 이벤트", "장마 대비 이벤트"],
14
- "7월": ["여름휴가 이벤트", "바다 여행 이벤트", "시원한 음식 이벤트"],
15
- "8월": ["휴가철 이벤트", "광복절 이벤트", "여름 추억 이벤트"],
16
- "9월": ["추석 이벤트", "가을 시작 이벤트", "독서의 계절 이벤트"],
17
- "10월": ["가을 단풍 이벤트", "한글날 이벤트", "가을 나들이 이벤트"],
18
- "11월": ["빼빼로데이 이벤트", "수능 응원 이벤트", "겨울 준비 이벤트"],
19
- "12월": ["크리스마스 이벤트", "연말 파티 이벤트", "한해 마무리 이벤트"]
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  }
21
 
22
- month_concepts = concepts.get(month, ["기본 이벤트"])
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
23
 
24
- result = f"# {month} 추천 컨셉\n\n"
25
- for i, concept in enumerate(month_concepts, 1):
26
- result += f"## {i}. {concept}\n"
27
- result += f"- 20-40대 여성 타겟\n"
28
- result += f"- 예상 참여도: 높음\n\n"
 
 
 
 
 
 
29
 
30
- return result, month_concepts
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
31
 
32
  def generate_notice(concept, event_type, event_period):
33
  """기본 공지사항 생성"""
@@ -132,8 +306,8 @@ def create_interface():
132
  gr.Markdown("## 결과")
133
 
134
  concept_output = gr.Textbox(
135
- label="분석 결과",
136
- lines=10,
137
  placeholder="먼저 '컨셉 분석하기' 버튼을 클릭하세요"
138
  )
139
 
 
2
  from datetime import datetime
3
 
4
  def analyze_concepts(month):
5
+ """고도화된 월별 컨셉 분석"""
6
+
7
+ # 월별 상세 데이터
8
+ monthly_data = {
9
+ "1월": {
10
+ "holidays": ["신정", "설날", "대보름"],
11
+ "special_days": ["새해 첫날", "성인의 ", "다이어트의 "],
12
+ "trends": ["새해 다짐", "다이어트", "정리정돈", "미니멀라이프", "헬스케어"],
13
+ "seasons": ["겨울", "신년", "눈꽃"],
14
+ "colors": ["#FF6B6B", "#4ECDC4", "#45B7D1"],
15
+ "mood": "희망적이고 새로운 시작"
16
+ },
17
+ "2월": {
18
+ "holidays": ["밸런타인데이", "정월대보름"],
19
+ "special_days": ["로즈데이", "초콜릿데이", "사랑의 "],
20
+ "trends": ["사랑", "로맨스", "셀프케어", "따뜻한 감성", "커플문화"],
21
+ "seasons": ["겨울 끝", "입춘", "매화"],
22
+ "colors": ["#FF69B4", "#FFB6C1", "#DC143C"],
23
+ "mood": "로맨틱하고 감성적"
24
+ },
25
+ "3월": {
26
+ "holidays": ["삼일절", "화이트데이"],
27
+ "special_days": ["여성의 날", "봄의 시작", "졸업식"],
28
+ "trends": ["봄맞이", "새학기", "벚꽃놀이", "봄나들이", "새출발"],
29
+ "seasons": ["봄", "벚꽃", "새싹"],
30
+ "colors": ["#FFB6C1", "#98FB98", "#87CEEB"],
31
+ "mood": "설렘가득하고 활기찬"
32
+ },
33
+ "4월": {
34
+ "holidays": ["만우절", "식목일"],
35
+ "special_days": ["블랙데이", "킹데이", "꽃구경"],
36
+ "trends": ["벚꽃축제", "봄피크닉", "아웃도어", "꽃놀이", "드라이브"],
37
+ "seasons": ["봄 절정", "꽃구경", "나들이"],
38
+ "colors": ["#98FB98", "#F0E68C", "#DDA0DD"],
39
+ "mood": "생기발랄하고 즐거운"
40
+ },
41
+ "5월": {
42
+ "holidays": ["어린이날", "어버이날", "스승의날", "부처님오신날"],
43
+ "special_days": ["가정의 달", "로즈데이", "감사의 달"],
44
+ "trends": ["가족사랑", "감사", "나들이", "선물", "효도여행"],
45
+ "seasons": ["신록", "야외활동", "따뜻함"],
46
+ "colors": ["#32CD32", "#FFB6C1", "#87CEEB"],
47
+ "mood": "따뜻하고 가족적인"
48
+ },
49
+ "6월": {
50
+ "holidays": ["현충일", "단오"],
51
+ "special_days": ["키스데이", "패밀리데이", "환경의 날"],
52
+ "trends": ["여름준비", "다이어트", "워터파크", "바캉스준비", "쿨링"],
53
+ "seasons": ["초여름", "장마 전", "더위"],
54
+ "colors": ["#00CED1", "#FFD700", "#FF6347"],
55
+ "mood": "시원하고 활동적인"
56
+ },
57
+ "7월": {
58
+ "holidays": ["제헌절", "초복", "중복"],
59
+ "special_days": ["실버데이", "썸머데이", "휴가철"],
60
+ "trends": ["여름휴가", "워터액티비티", "시원한음식", "휴가패션", "바다여행"],
61
+ "seasons": ["여름", "장마", "휴가"],
62
+ "colors": ["#00BFFF", "#FFD700", "#FF6347"],
63
+ "mood": "역동적이고 시원한"
64
+ },
65
+ "8월": {
66
+ "holidays": ["광복절", "말복"],
67
+ "special_days": ["그린데이", "바캉스", "여름 끝"],
68
+ "trends": ["여름휴가절정", "바다여행", "축제", "여름추억", "해외여행"],
69
+ "seasons": ["한여름", "무더위", "휴가철"],
70
+ "colors": ["#00BFFF", "#FF6347", "#FFD700"],
71
+ "mood": "열정적이고 추억가득한"
72
+ },
73
+ "9월": {
74
+ "holidays": ["추석", "추분"],
75
+ "special_days": ["포토데이", "뮤직데이", "한가위"],
76
+ "trends": ["추석준비", "가을패션", "독서", "문화생활", "전통"],
77
+ "seasons": ["가을", "추석", "선선함"],
78
+ "colors": ["#FF8C00", "#DC143C", "#B8860B"],
79
+ "mood": "풍성하고 따뜻한"
80
+ },
81
+ "10월": {
82
+ "holidays": ["개천절", "한글날"],
83
+ "special_days": ["와인데이", "커피데이", "독서의 달"],
84
+ "trends": ["가을단풍", "독서", "카페문화", "가을나들이", "문화예술"],
85
+ "seasons": ["단풍", "가을정취", "쌀쌀함"],
86
+ "colors": ["#FF8C00", "#DC143C", "#B8860B"],
87
+ "mood": "감성적이고 성숙한"
88
+ },
89
+ "11월": {
90
+ "holidays": ["빼빼로데이", "수능"],
91
+ "special_days": ["무비데이", "오렌지데이", "김장철"],
92
+ "trends": ["빼빼로데이", "수능응원", "겨울준비", "연말준비", "감사"],
93
+ "seasons": ["늦가을", "쌀쌀함", "겨울준비"],
94
+ "colors": ["#8B4513", "#A0522D", "#CD853F"],
95
+ "mood": "포근하고 준비하는"
96
+ },
97
+ "12월": {
98
+ "holidays": ["크리스마스", "성탄절", "동지"],
99
+ "special_days": ["허그데이", "키스데이", "연말"],
100
+ "trends": ["크리스마스", "연말파티", "선물", "한해마무리", "송년회"],
101
+ "seasons": ["겨울", "연말", "눈"],
102
+ "colors": ["#DC143C", "#228B22", "#FFD700"],
103
+ "mood": "축제같고 마무리하는"
104
+ }
105
  }
106
 
107
+ data = monthly_data.get(month, {})
108
+
109
+ # 5가지 상세 컨셉 생성
110
+ concepts = []
111
+
112
+ # 컨셉 1: 주요 기념일 기반
113
+ if data.get("holidays"):
114
+ main_holiday = data["holidays"][0]
115
+ concepts.append({
116
+ "name": f"{main_holiday} 특별 이벤트",
117
+ "theme": f"{main_holiday}를 테마로 한 감성 이벤트",
118
+ "score": 8.5,
119
+ "reason": f"{month}의 대표 기념일로 높은 관심도와 참여 예상",
120
+ "target": "20-40대 여성, 기념일 중시하는 층",
121
+ "colors": data.get("colors", ["#FF69B4"]),
122
+ "keywords": [main_holiday] + data.get("trends", [])[:2],
123
+ "participation_factor": "기념일 특별감, 시즌성"
124
+ })
125
+
126
+ # 컨셉 2: 트렌드 기반
127
+ if data.get("trends"):
128
+ main_trend = data["trends"][0]
129
+ concepts.append({
130
+ "name": f"{main_trend} 챌린지",
131
+ "theme": f"최신 {main_trend} 트렌드 참여형 이벤트",
132
+ "score": 8.0,
133
+ "reason": f"현재 핫한 {main_trend} 트렌드로 젊은 층 높은 관심",
134
+ "target": "20-30대 트렌드 민감층, SNS 활용층",
135
+ "colors": data.get("colors", ["#4ECDC4"]),
136
+ "keywords": data.get("trends", [])[:3],
137
+ "participation_factor": "트렌드 화제성, SNS 확산성"
138
+ })
139
+
140
+ # 컨셉 3: 계절감 기반
141
+ if data.get("seasons"):
142
+ season = data["seasons"][0]
143
+ concepts.append({
144
+ "name": f"{season} 라이프 이벤트",
145
+ "theme": f"{season} 계절감을 살린 일상 이벤트",
146
+ "score": 7.5,
147
+ "reason": f"{season} 계절 특성으로 자연스러운 참여 유도",
148
+ "target": "전연령대, 계절감 중시하는 감성적 층",
149
+ "colors": data.get("colors", ["#98FB98"]),
150
+ "keywords": data.get("seasons", []) + data.get("trends", [])[:1],
151
+ "participation_factor": "계절 공감대, 일상 연관성"
152
+ })
153
+
154
+ # 컨셉 4: 스페셜 데이 기반
155
+ if data.get("special_days"):
156
+ special = data["special_days"][0]
157
+ concepts.append({
158
+ "name": f"{special} 스페셜 위크",
159
+ "theme": f"{special} 맞이 특별 혜택 이벤트",
160
+ "score": 7.8,
161
+ "reason": f"{special}의 특별함으로 프리미엄 이벤트 효과",
162
+ "target": "20-40대 여성, 혜택 관심층",
163
+ "colors": data.get("colors", ["#FFB6C1"]),
164
+ "keywords": data.get("special_days", [])[:2] + ["혜택", "특별"],
165
+ "participation_factor": "특별함 기대, 혜택 매력도"
166
+ })
167
 
168
+ # 컨셉 5: 커뮤니티 소통 기반
169
+ concepts.append({
170
+ "name": f"{month} 우리들의 이야기",
171
+ "theme": "커뮤니티 멤버 소통과 공감 이벤트",
172
+ "score": 7.0,
173
+ "reason": "커뮤니티 결속력 강화와 지속적 참여 유도",
174
+ "target": "기존 회원, 커뮤니티 활동 적극층",
175
+ "colors": data.get("colors", ["#87CEEB"]),
176
+ "keywords": ["소통", "공감", "스토리", "우리"],
177
+ "participation_factor": "소속감, 진정성"
178
+ })
179
 
180
+ # 결과 텍스트 생성
181
+ result = f"# 🎯 {month} 고도화된 컨셉 분석\n\n"
182
+ result += f"**📊 분석 기준:** {data.get('mood', '특별한')} 분위기\n"
183
+ result += f"**🎨 주요 색상:** {', '.join(data.get('colors', ['기본색상'])[:3])}\n"
184
+ result += f"**🔥 핵심 트렌드:** {', '.join(data.get('trends', ['기본트렌드'])[:3])}\n\n"
185
+
186
+ concept_names = []
187
+
188
+ for i, concept in enumerate(concepts, 1):
189
+ result += f"## {i}. {concept['name']}\n"
190
+ result += f"**🏷️ 테마:** {concept['theme']}\n"
191
+ result += f"**⭐ 참여도 점수:** {concept['score']}/10점\n"
192
+ result += f"**💡 선정 이유:** {concept['reason']}\n"
193
+ result += f"**🎯 주요 타겟:** {concept['target']}\n"
194
+ result += f"**🔑 핵심 키워드:** {', '.join(concept['keywords'])}\n"
195
+ result += f"**📈 참여 요인:** {concept['participation_factor']}\n"
196
+ result += f"**🎨 추천 색상:** {', '.join(concept['colors'])}\n\n"
197
+ result += "---\n\n"
198
+
199
+ concept_names.append(concept['name'])
200
+
201
+ result += f"**💬 총평:** {month}은 {data.get('mood', '특별한')} 특성을 가진 달로, "
202
+ result += f"특히 '{data.get('trends', ['트렌드'])[0]}' 관련 이벤트가 높은 참여도를 보일 것으로 예상됩니다."
203
+
204
+ return result, concept_names
205
 
206
  def generate_notice(concept, event_type, event_period):
207
  """기본 공지사항 생성"""
 
306
  gr.Markdown("## 결과")
307
 
308
  concept_output = gr.Textbox(
309
+ label="고도화된 분석 결과",
310
+ lines=20,
311
  placeholder="먼저 '컨셉 분석하기' 버튼을 클릭하세요"
312
  )
313