File size: 9,384 Bytes
624787d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
import gradio as gr
import datetime
import calendar

class EventManager:
    def __init__(self):
        # 월별 기본 컨셉 정의
        self.monthly_concepts = {
            1: {"theme": "신년/설날", "colors": ["#FF6B6B", "#FFE66D"], "mood": "희망찬, 따뜻한"},
            2: {"theme": "발렌타인데이", "colors": ["#FF69B4", "#FFB6C1"], "mood": "로맨틱, 달콤한"},
            3: {"theme": "화이트데이/봄", "colors": ["#FFFFFF", "#F0F8FF"], "mood": "순수한, 상쾌한"},
            4: {"theme": "벚꽃/봄나들이", "colors": ["#FFB7C5", "#98FB98"], "mood": "생기발랄, 활기찬"},
            5: {"theme": "로즈데이/가정의달", "colors": ["#FF1493", "#FF69B4"], "mood": "감사한, 사랑스러운"},
            6: {"theme": "결혼시즌/초여름", "colors": ["#87CEEB", "#F0E68C"], "mood": "청량한, 행복한"},
            7: {"theme": "여름휴가", "colors": ["#00CED1", "#FFE4B5"], "mood": "시원한, 자유로운"},
            8: {"theme": "무더위극복", "colors": ["#20B2AA", "#F0FFFF"], "mood": "시원한, 에너지 넘치는"},
            9: {"theme": "가을시작", "colors": ["#DEB887", "#CD853F"], "mood": "따뜻한, 아늑한"},
            10: {"theme": "할로윈", "colors": ["#FF4500", "#8B0000"], "mood": "신비로운, 재미있는"},
            11: {"theme": "단풍/감사", "colors": ["#DAA520", "#B22222"], "mood": "감사한, 따뜻한"},
            12: {"theme": "크리스마스/연말", "colors": ["#DC143C", "#228B22"], "mood": "축제같은, 따뜻한"}
        }
        
        # 이벤트 타입별 기본 설정
        self.event_types = {
            "댓글이벤트": {
                "action": "댓글 작성",
                "reward_frequency": "1시간마다",
                "participation": "유익하고 착한 댓글 남기기"
            },
            "채용공고": {
                "action": "채용공고 확인",
                "reward_frequency": "일별",
                "participation": "채용공고 열람 및 지원"
            },
            "게시글작성": {
                "action": "게시글 작성",
                "reward_frequency": "일별",
                "participation": "양질의 게시글 작성"
            }
        }

    def calculate_event_duration(self, start_date: str, end_date: str):
        """이벤트 기간 계산"""
        try:
            start = datetime.datetime.strptime(start_date, "%Y-%m-%d")
            end = datetime.datetime.strptime(end_date, "%Y-%m-%d")
            duration = (end - start).days + 1
            month = start.month
            return duration, month
        except:
            return 0, 0

    def generate_monthly_concept(self, month: int):
        """월별 컨셉 생성"""
        if month in self.monthly_concepts:
            concept = self.monthly_concepts[month]
            return {
                "theme": concept["theme"],
                "colors": concept["colors"],
                "mood": concept["mood"],
                "month_name": calendar.month_name[month]
            }
        return {}

    def generate_event_copy(self, event_type: str, concept: Dict, duration: int, 
                           custom_details: str = "") -> str:
        """이벤트 카피 생성"""
        if not concept:
            return "먼저 이벤트 기간을 설정해주세요."
        
        theme = concept.get("theme", "특별한")
        mood = concept.get("mood", "즐거운")
        
        base_copy = f"""✨ {theme} 특별 이벤트 ✨
{mood} {theme} 시즌을 맞아 특별한 이벤트를 준비했어요!

🎯 이벤트 참여방법
{self.event_types.get(event_type, {}).get('participation', '이벤트에 참여하세요')}

⏰ 이벤트 기간
{duration}일간 진행되는 특별한 이벤트입니다!

🎁 혜택
{self.event_types.get(event_type, {}).get('reward_frequency', '정기적으로')} 선물을 드려요!
"""
        
        if custom_details:
            base_copy += f"\n📝 추가 정보\n{custom_details}"
            
        return base_copy

    def generate_design_advice(self, concept: Dict) -> str:
        """디자인 조언 생성"""
        if not concept:
            return "컨셉 정보가 필요합니다."
        
        colors = concept.get("colors", ["#000000", "#FFFFFF"])
        mood = concept.get("mood", "")
        theme = concept.get("theme", "")
        
        advice = f"""🎨 디자인 조언

🎯 컬러 팔레트
- 메인 컬러: {colors[0]}
- 서브 컬러: {colors[1]}
- 20-40대 여성에게 어필하는 {mood} 느낌

📐 레이아웃 추천
- 제목: 큰 폰트로 임팩트 있게
- 핵심 정보: 시각적으로 구분되는 박스 활용
- CTA 버튼: 눈에 띄는 컬러로 강조
- 이미지: {theme} 테마에 맞는 일러스트 활용

👀 가독성 향상
- 충분한 여백 활용
- 계층적 정보 구조
- 스캔하기 쉬운 레이아웃
- 모바일 친화적 디자인"""

        return advice

def create_interface():
    event_manager = EventManager()
    
    with gr.Blocks(title="이벤트 관리 시스템", theme=gr.themes.Soft()) as demo:
        gr.Markdown("# 🎉 이벤트 관리 시스템")
        gr.Markdown("월별 이벤트 기획부터 디자인 조언까지 한 번에!")
        
        with gr.Row():
            with gr.Column(scale=1):
                gr.Markdown("## 📅 이벤트 기본 정보")
                
                start_date = gr.Textbox(
                    label="이벤트 시작일",
                    placeholder="YYYY-MM-DD (예: 2025-05-15)",
                    value="2025-05-15"
                )
                
                end_date = gr.Textbox(
                    label="이벤트 종료일", 
                    placeholder="YYYY-MM-DD (예: 2025-05-25)",
                    value="2025-05-25"
                )
                
                event_type = gr.Dropdown(
                    choices=list(event_manager.event_types.keys()),
                    label="이벤트 종류",
                    value="댓글이벤트"
                )
                
                custom_details = gr.Textbox(
                    label="추가 상세내용",
                    placeholder="특별한 조건이나 상세 내용을 입력하세요",
                    lines=3
                )
                
                generate_btn = gr.Button("✨ 이벤트 생성하기", variant="primary")
            
            with gr.Column(scale=2):
                gr.Markdown("## 📊 생성 결과")
                
                duration_info = gr.Textbox(
                    label="이벤트 기간 정보",
                    interactive=False
                )
                
                concept_info = gr.Textbox(
                    label="월별 컨셉 정보",
                    interactive=False,
                    lines=3
                )
                
                event_copy = gr.Textbox(
                    label="이벤트 카피",
                    interactive=False,
                    lines=8
                )
                
                design_advice = gr.Textbox(
                    label="디자인 조언",
                    interactive=False,
                    lines=10
                )
        
        def generate_event_content(start_date_val, end_date_val, event_type_val, custom_details_val):
            # 기간 계산
            duration, month = event_manager.calculate_event_duration(start_date_val, end_date_val)
            
            if duration == 0:
                return "날짜 형식을 확인해주세요", "", "", ""
            
            duration_text = f"{duration}일간 ({start_date_val} ~ {end_date_val})"
            
            # 월별 컨셉 생성
            concept = event_manager.generate_monthly_concept(month)
            concept_text = f"테마: {concept.get('theme', '')}\n분위기: {concept.get('mood', '')}\n컬러: {', '.join(concept.get('colors', []))}"
            
            # 카피 생성
            copy_text = event_manager.generate_event_copy(event_type_val, concept, duration, custom_details_val)
            
            # 디자인 조언 생성
            design_text = event_manager.generate_design_advice(concept)
            
            return duration_text, concept_text, copy_text, design_text
        
        generate_btn.click(
            fn=generate_event_content,
            inputs=[start_date, end_date, event_type, custom_details],
            outputs=[duration_info, concept_info, event_copy, design_advice]
        )
        
        gr.Markdown("""
        ## 📝 사용 가이드
        1. **이벤트 기간 설정**: 시작일과 종료일을 YYYY-MM-DD 형식으로 입력
        2. **이벤트 종류 선택**: 드롭다운에서 이벤트 타입 선택
        3. **추가 정보 입력**: 특별한 조건이나 상세내용 입력 (선택사항)
        4. **생성하기 클릭**: 자동으로 컨셉, 카피, 디자인 조언 생성
        
        ### 🎯 다음 단계 개발 예정
        - 이미지 레퍼런스 분석 기능
        - 상세한 공지사항 템플릿
        - 이벤트 종류별 맞춤 설정
        """)
    
    return demo

if __name__ == "__main__":
    demo = create_interface()
    demo.launch(share=True)