Sangwon78 commited on
Commit
4545c72
ยท
verified ยท
1 Parent(s): f579f56

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +75 -99
app.py CHANGED
@@ -32,7 +32,6 @@ def call_api(content, system_message, max_tokens, temperature, top_p):
32
  # 1) ์• ๋กœ์‚ฌํ•ญ/๋ชฉํ‘œ ๋ถ„์„
33
  ######################
34
  def analyze_texts(difficulties, goals):
35
- # ์• ๋กœ์‚ฌํ•ญ
36
  preview_difficulties = call_api(
37
  content=difficulties,
38
  system_message=(
@@ -44,7 +43,6 @@ def analyze_texts(difficulties, goals):
44
  temperature=0.7,
45
  top_p=0.9,
46
  )
47
- # ์ปจ์„คํŒ…๋ชฉํ‘œ
48
  preview_goals = call_api(
49
  content=goals,
50
  system_message=(
@@ -59,13 +57,9 @@ def analyze_texts(difficulties, goals):
59
  return preview_difficulties, preview_goals
60
 
61
  ######################
62
- # 2) SWOT ๋ถ„์„(4์นธ)
63
  ######################
64
  def analyze_swot(strengths, weaknesses, opportunities, threats):
65
- """
66
- ๊ฐ•์ , ์•ฝ์ , ๊ธฐํšŒ, ์œ„ํ˜‘์„ ๊ฐ๊ฐ ์š”์•ฝ.
67
- ์ตœ์ข…์€ '๊ฐ•์ :', '์•ฝ์ :', '๊ธฐํšŒ:', '์œ„ํ˜‘:' ๋„ค ์ค„๋กœ ์‘๋‹ต.
68
- """
69
  system_message = (
70
  "๋‹น์‹ ์€ swot ๋ถ„์„ ์ „๋ฌธ๊ฐ€์ž…๋‹ˆ๋‹ค. "
71
  "์ž…๋ ฅ๋œ ๊ฐ•์ , ์•ฝ์ , ๊ธฐํšŒ, ์œ„ํ˜‘์„ ๊ฐ๊ฐ ์š”์•ฝํ•ด ์ฃผ์„ธ์š”. "
@@ -85,13 +79,13 @@ def analyze_swot(strengths, weaknesses, opportunities, threats):
85
  return call_api(
86
  content=content,
87
  system_message=system_message,
88
- max_tokens=700,
89
  temperature=0.7,
90
  top_p=1.0
91
  )
92
 
93
  ######################
94
- # 3) ์žฌ๋ฌด ๋ถ„์„(12๊ฐœ ํ•ญ๋ชฉ ์ถœ๋ ฅ)
95
  ######################
96
  def analyze_financials(
97
  avg_monthly_sales,
@@ -103,54 +97,38 @@ def analyze_financials(
103
  other_cost,
104
  cost_ratio
105
  ):
106
- """
107
- ์‚ฌ์šฉ์ž ์ž…๋ ฅ 8๊ฐœ(์›”ํ‰๊ท ๋งค์ถœ์•ก, ์ž„์ฐจ๋ฃŒ, ์ธ๊ฑด๋น„, ๊ด€๋ฆฌ๋น„, ์ˆ˜๋„๊ด‘์—ด๋น„, ์ง€๊ธˆ์ด์ž, ๊ธฐํƒ€๋น„์šฉ, ์›๊ฐ€์œจ)๋ฅผ
108
- ๊ทธ๋Œ€๋กœ ํ‘œ์‹œํ•ด์ฃผ๊ณ , ์ถ”๊ฐ€๋กœ
109
- (๊ฐ๊ฐ€์ƒ๊ฐ๋น„, ์ˆœ์ด์ต์œจ, ์›”์ˆœ์ˆ˜์ต, ์†์ต๋ถ„๊ธฐ์ ) 4๊ฐœ๋ฅผ ๊ณ„์‚ฐ/์ถ”์ •ํ•˜์—ฌ ํ•ฉ์ณ ์ด 12์ค„๋กœ
110
- 'ํ•ญ๋ชฉ๋ช…: ์ˆ˜์น˜' ํ˜•ํƒœ๋กœ๋งŒ ์ถœ๋ ฅํ•˜๋Š” ํ•จ์ˆ˜.
111
- """
112
  system_message = (
113
- "๋‹น์‹ ์€ ์„ธ๋ฌด์‚ฌ(ํšŒ๊ณ„์‚ฌ)์ž…๋‹ˆ๋‹ค. ์•„๋ž˜ ์ž…๋ ฅ๊ฐ’์„ ๋ชจ๋‘ ํ‘œ์‹œ(1~8)ํ•˜๊ณ , "
114
- "์ถ”๊ฐ€๋กœ 9)๊ฐ๊ฐ€์ƒ๊ฐ๋น„, 10)์ˆœ์ด์ต์œจ, 11)์›”์ˆœ์ˆ˜์ต, 12)์†์ต๋ถ„๊ธฐ์ ์„ "
115
- "'ํ•ญ๋ชฉ๋ช…: ์ˆ˜์น˜' ํ˜•ํƒœ๋กœ๋งŒ ๋ฐ˜ํ™˜ํ•ด์ฃผ์„ธ์š”. "
116
- "์ด 12์ค„, ๊ฐ ์ค„์— ํ•ญ๋ชฉ๋ช…: ๊ฐ’ ๋งŒ. "
117
- "์ถ”๊ฐ€ ์„ค๋ช…์ด๋‚˜ ๋ฌธ์žฅ์€ ๋„ฃ์ง€ ๋ง์•„์ฃผ์„ธ์š”."
118
  )
119
  content = f"""
120
  ์ž…๋ ฅ:
121
- 1) ์›”ํ‰๊ท ๋งค์ถœ์•ก: {avg_monthly_sales}
122
- 2) ์ž„์ฐจ๋ฃŒ: {rent}
123
- 3) ์ธ๊ฑด๋น„: {labor_cost}
124
- 4) ๊ด€๋ฆฌ๋น„: {management_cost}
125
- 5) ์ˆ˜๋„๊ด‘์—ด๋น„: {utilities}
126
- 6) ์ง€๊ธˆ์ด์ž: {current_interest}
127
- 7) ๊ธฐํƒ€๋น„์šฉ: {other_cost}
128
- 8) ์›๊ฐ€์œจ: {cost_ratio}
129
-
130
- ๊ฒฐ๊ณผ ํ•ญ๋ชฉ(12์ค„, ํ•ญ๋ชฉ๋ช…: ์ˆ˜์น˜):
131
- 1) ์›”ํ‰๊ท ๋งค์ถœ์•ก
132
- 2) ์ž„์ฐจ๋ฃŒ
133
- 3) ์ธ๊ฑด๋น„
134
- 4) ๊ด€๋ฆฌ๋น„
135
- 5) ์ˆ˜๋„๊ด‘์—ด๋น„
136
- 6) ์ง€๊ธˆ์ด์ž
137
- 7) ๊ธฐํƒ€๋น„์šฉ
138
- 8) ์›๊ฐ€์œจ
139
- 9) ๊ฐ๊ฐ€์ƒ๊ฐ๋น„
140
- 10) ์ˆœ์ด์ต์œจ
141
- 11) ์›”์ˆœ์ˆ˜์ต
142
- 12) ์†์ต๋ถ„๊ธฐ์ 
143
  """
144
  return call_api(
145
  content=content,
146
  system_message=system_message,
147
- max_tokens=800,
148
  temperature=0.7,
149
  top_p=1.0
150
  )
151
 
152
  ######################
153
- # 4) ์ƒ๊ถŒ ๋ถ„์„(1์ค„)
154
  ######################
155
  def analyze_market(region, industry):
156
  system_message = (
@@ -170,7 +148,7 @@ def analyze_market(region, industry):
170
  )
171
 
172
  ######################
173
- # run_all_in_one
174
  ######################
175
  def run_all_in_one(
176
  # (A) ์ƒ๋‹จ 8๊ฐœ
@@ -193,7 +171,7 @@ def run_all_in_one(
193
  opportunities_input,
194
  threats_input,
195
 
196
- # (D) ์žฌ๋ฌด๋ถ„์„ (12๊ฐœ ํ•ญ๋ชฉ ์ถœ๋ ฅ)
197
  avg_monthly_sales,
198
  rent,
199
  labor_cost,
@@ -207,41 +185,42 @@ def run_all_in_one(
207
  region_input,
208
  industry_input,
209
 
210
- # (F) ์‚ฌ์ง„ (๊ฐ€๋กœ7cm, ์„ธ๋กœ5cm)
211
  photo1,
212
  photo2
213
  ):
214
  """
215
- - 1) GPT: ์• ๋กœ์‚ฌํ•ญ/๋ชฉํ‘œ
216
- - 2) GPT: SWOT(4์นธ)
217
- - 3) GPT: ์žฌ๋ฌด(12์ค„)
218
- - 4) GPT: ์ƒ๊ถŒ(1์ค„)
219
- - => EXE.xlsx์— ๊ธฐ๋ก
220
- - => ์‚ฌ์ง„ ๊ฐ€๋กœ=7cm, ์„ธ๋กœ=5cm
 
221
  """
222
 
223
- # 1) ์• ๋กœ์‚ฌํ•ญ/๋ชฉํ‘œ
224
  preview_difficulties, preview_goals = analyze_texts(difficulties_input, goals_input)
225
 
226
- # 2) SWOT
227
  swot_result = analyze_swot(strengths_input, weaknesses_input, opportunities_input, threats_input)
228
  swot_lines = swot_result.split("\n")
229
- strength_line = next((x for x in swot_lines if x.startswith("๊ฐ•์ :")), "")
230
- weakness_line = next((x for x in swot_lines if x.startswith("์•ฝ์ :")), "")
231
- opportunity_line = next((x for x in swot_lines if x.startswith("๊ธฐํšŒ:")), "")
232
- threat_line = next((x for x in swot_lines if x.startswith("์œ„ํ˜‘:")), "")
233
 
234
- # 3) ์žฌ๋ฌด(12์ค„)
235
  fin_result = analyze_financials(
236
  avg_monthly_sales, rent, labor_cost, management_cost,
237
  utilities, current_interest, other_cost, cost_ratio
238
  )
239
- fin_lines = fin_result.split("\n") # ์ด 12์ค„ (ํ•ญ๋ชฉ๋ช…: ๊ฐ’)
240
 
241
- # 4) ์ƒ๊ถŒ
242
  market_result = analyze_market(region_input, industry_input)
243
 
244
- # ์ด์ œ EXE.xlsx
245
  wb = load_workbook("EXE.xlsx")
246
  ws = wb.active
247
 
@@ -278,20 +257,22 @@ def run_all_in_one(
278
  ws["G7"] = consulting_region
279
  ws["G7"].alignment = Alignment(horizontal="center", vertical="center")
280
 
281
- # (B) ์• ๋กœ์‚ฌํ•ญ(D11), ์ปจ์„คํŒ…๋ชฉํ‘œ(D22)
282
  ws["D11"] = preview_difficulties
283
  ws["D11"].alignment = Alignment(wrap_text=True)
 
284
  ws["D22"] = preview_goals
285
- ws["D22"].alignment = Alignment(wrap_text=True)
 
286
 
287
- # (F) ์‚ฌ์ง„(๊ฐ€๋กœ 7cm, ์„ธ๋กœ 5cm)
288
  if photo1 is not None:
289
  img1_bytes = BytesIO()
290
  photo1.save(img1_bytes, format="PNG")
291
  img1_bytes.seek(0)
292
  img_for_excel_1 = ExcelImage(img1_bytes)
293
- img_for_excel_1.width = int(37.79 * 7) # ๊ฐ€๋กœ 7cm
294
- img_for_excel_1.height = int(37.79 * 5) # ์„ธ๋กœ 5cm
295
  ws.add_image(img_for_excel_1, "B117")
296
 
297
  if photo2 is not None:
@@ -299,11 +280,11 @@ def run_all_in_one(
299
  photo2.save(img2_bytes, format="PNG")
300
  img2_bytes.seek(0)
301
  img_for_excel_2 = ExcelImage(img2_bytes)
302
- img_for_excel_2.width = int(37.79 * 7) # ๊ฐ€๋กœ 7cm
303
- img_for_excel_2.height = int(37.79 * 5) # ์„ธ๋กœ 5cm
304
  ws.add_image(img_for_excel_2, "F117")
305
 
306
- # (C) SWOT ๊ฒฐ๊ณผ (4์นธ)
307
  ws.merge_cells("D45:H45")
308
  ws["D45"] = strength_line
309
  ws["D45"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
@@ -320,29 +301,24 @@ def run_all_in_one(
320
  ws["D72"] = threat_line
321
  ws["D72"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
322
 
323
- # (D) ์žฌ๋ฌด(12ํ•ญ๋ชฉ) => E87:F87:G87 ~ E98:F98:G98
324
- # ๋งŒ์•ฝ E87:F87:G87 ๋“ฑ์ด ๋ณ‘ํ•ฉ๋˜์–ด ์žˆ๋‹ค๋ฉด, ๊ฐœ๋ณ„ ์…€ ์“ฐ๊ธฐ ์‹œ 'MergedCell' ์—๋Ÿฌ๊ฐ€ ๋‚  ์ˆ˜ ์žˆ์œผ๋‹ˆ ์ฃผ์˜.
325
- # ์‚ฌ์šฉ์ž ์š”์ฒญ๋Œ€๋กœ "์˜› ๋ฐฉ์‹"์œผ๋กœ 3์…€ ๊ฐ๊ฐ ๊ฐ’ ๋ฐฐ์น˜ ์˜ˆ์‹œ
326
- # (1~8 = ์ž…๋ ฅ, 9~12 = ๊ณ„์‚ฐ)
327
- # fin_lines[i] = "ํ•ญ๋ชฉ๋ช…: ๊ฐ’"
328
-
329
- lines_count = len(fin_lines) # ์ตœ๋Œ€ 12์ค„
330
- for i in range(lines_count):
331
- row_idx = 87 + i # E87..E98
332
- # 1) E=ํ•ญ๋ชฉ๋ช…, 2) F=๊ฐ’, 3) G=๋นˆ์นธ
333
- parts = fin_lines[i].split(":")
334
- label = parts[0].strip() if len(parts) > 0 else ""
335
- val = parts[1].strip() if len(parts) > 1 else ""
336
-
337
- ws[f"E{row_idx}"] = label
338
- ws[f"F{row_idx}"] = val
339
- ws[f"G{row_idx}"] = ""
340
-
341
- # ์ •๋ ฌ
342
- for c_ in ["E", "F", "G"]:
343
- ws[f"{c_}{row_idx}"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
344
-
345
- # (E) ์ƒ๊ถŒ๋ถ„์„(D101:H101)
346
  ws.merge_cells("D101:H101")
347
  ws["D101"] = market_result
348
  ws["D101"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
@@ -390,7 +366,7 @@ def main():
390
 
391
  gr.Markdown("---")
392
 
393
- # (C) SWOT(4์นธ)
394
  strengths_input = gr.Textbox(label="๊ฐ•์ ")
395
  weaknesses_input = gr.Textbox(label="์•ฝ์ ")
396
  opportunities_input = gr.Textbox(label="๊ธฐํšŒ")
@@ -398,7 +374,7 @@ def main():
398
 
399
  gr.Markdown("---")
400
 
401
- # (D) ์žฌ๋ฌด(12๊ฐœ ํ•ญ๋ชฉ - 8๊ฐœ ์ž…๋ ฅ + GPT 4๊ฐœ)
402
  with gr.Row():
403
  avg_monthly_sales_input = gr.Textbox(label="์›”ํ‰๊ท ๋งค์ถœ์•ก")
404
  rent_input = gr.Textbox(label="์ž„์ฐจ๋ฃŒ")
@@ -419,7 +395,7 @@ def main():
419
 
420
  gr.Markdown("---")
421
 
422
- # (F) ์‚ฌ์ง„ (๊ฐ€๋กœ 7cm, ์„ธ๋กœ 5cm)
423
  with gr.Row():
424
  photo_input_1 = gr.Image(label="์ˆ˜์ง„์—…์ฒด์‚ฌ์ง„1", type="pil")
425
  photo_input_2 = gr.Image(label="์ˆ˜์ง„์—…์ฒด์‚ฌ์ง„2", type="pil")
@@ -447,13 +423,13 @@ def main():
447
  difficulties_input,
448
  goals_input,
449
 
450
- # (C) SWOT(4์นธ)
451
  strengths_input,
452
  weaknesses_input,
453
  opportunities_input,
454
  threats_input,
455
 
456
- # (D) ์žฌ๋ฌด(8์ž…๋ ฅ+4๊ณ„์‚ฐ=12ํ•ญ๋ชฉ)
457
  avg_monthly_sales_input,
458
  rent_input,
459
  labor_cost_input,
 
32
  # 1) ์• ๋กœ์‚ฌํ•ญ/๋ชฉํ‘œ ๋ถ„์„
33
  ######################
34
  def analyze_texts(difficulties, goals):
 
35
  preview_difficulties = call_api(
36
  content=difficulties,
37
  system_message=(
 
43
  temperature=0.7,
44
  top_p=0.9,
45
  )
 
46
  preview_goals = call_api(
47
  content=goals,
48
  system_message=(
 
57
  return preview_difficulties, preview_goals
58
 
59
  ######################
60
+ # 2) SWOT ๋ถ„์„ (4์นธ)
61
  ######################
62
  def analyze_swot(strengths, weaknesses, opportunities, threats):
 
 
 
 
63
  system_message = (
64
  "๋‹น์‹ ์€ swot ๋ถ„์„ ์ „๋ฌธ๊ฐ€์ž…๋‹ˆ๋‹ค. "
65
  "์ž…๋ ฅ๋œ ๊ฐ•์ , ์•ฝ์ , ๊ธฐํšŒ, ์œ„ํ˜‘์„ ๊ฐ๊ฐ ์š”์•ฝํ•ด ์ฃผ์„ธ์š”. "
 
79
  return call_api(
80
  content=content,
81
  system_message=system_message,
82
+ max_tokens=500,
83
  temperature=0.7,
84
  top_p=1.0
85
  )
86
 
87
  ######################
88
+ # 3) ์žฌ๋ฌด ๋ถ„์„ (4์ค„)
89
  ######################
90
  def analyze_financials(
91
  avg_monthly_sales,
 
97
  other_cost,
98
  cost_ratio
99
  ):
 
 
 
 
 
 
100
  system_message = (
101
+ "๋‹น์‹ ์€ ์„ธ๋ฌด์‚ฌ(ํšŒ๊ณ„์‚ฌ)์ž…๋‹ˆ๋‹ค. ์•„๋ž˜ ์ž…๋ ฅ๊ฐ’์„ ๋ฐ”ํƒ•์œผ๋กœ ๊ณ„์‚ฐํ•œ ๊ฐ๊ฐ€์ƒ๊ฐ๋น„, ์ˆœ์ด์ต์œจ, "
102
+ "์›”์ˆœ์ˆ˜์ต, ์†์ต๋ถ„๊ธฐ์ ์„ '์ œ๋ชฉ: ์ˆ˜์น˜' ํ˜•ํƒœ๋กœ๋งŒ ์•Œ๋ ค์ฃผ์„ธ์š”. "
103
+ "์ถ”๊ฐ€ ์„ค๋ช… ์—†์ด ํ•ญ๋ชฉ๋ช…: ๊ฐ’ ํ˜•ํƒœ๋งŒ."
 
 
104
  )
105
  content = f"""
106
  ์ž…๋ ฅ:
107
+ - ์›”ํ‰๊ท ๋งค์ถœ์•ก: {avg_monthly_sales}
108
+ - ์ž„์ฐจ๋ฃŒ: {rent}
109
+ - ์ธ๊ฑด๋น„: {labor_cost}
110
+ - ๊ด€๋ฆฌ๋น„: {management_cost}
111
+ - ์ˆ˜๋„๊ด‘์—ด๋น„: {utilities}
112
+ - ์ง€๊ธˆ์ด์ž: {current_interest}
113
+ - ๊ธฐํƒ€๋น„์šฉ: {other_cost}
114
+ - ์›๊ฐ€์œจ: {cost_ratio}
115
+
116
+ ๊ฒฐ๊ณผ ํ•ญ๋ชฉ:
117
+ 1) ๊ฐ๊ฐ€์ƒ๊ฐ๋น„
118
+ 2) ์ˆœ์ด์ต์œจ
119
+ 3) ์›”์ˆœ์ˆ˜์ต
120
+ 4) ์†์ต๋ถ„๊ธฐ์ 
 
 
 
 
 
 
 
 
121
  """
122
  return call_api(
123
  content=content,
124
  system_message=system_message,
125
+ max_tokens=500,
126
  temperature=0.7,
127
  top_p=1.0
128
  )
129
 
130
  ######################
131
+ # 4) ์ƒ๊ถŒ ๋ถ„์„ (1์ค„)
132
  ######################
133
  def analyze_market(region, industry):
134
  system_message = (
 
148
  )
149
 
150
  ######################
151
+ # ์ตœ์ข…: ํ•œ ๋ฒˆ์— EXE.xlsx ์ž‘์„ฑ
152
  ######################
153
  def run_all_in_one(
154
  # (A) ์ƒ๋‹จ 8๊ฐœ
 
171
  opportunities_input,
172
  threats_input,
173
 
174
+ # (D) ์žฌ๋ฌด๋ถ„์„ (4์ค„)
175
  avg_monthly_sales,
176
  rent,
177
  labor_cost,
 
185
  region_input,
186
  industry_input,
187
 
188
+ # (F) ์‚ฌ์ง„
189
  photo1,
190
  photo2
191
  ):
192
  """
193
+ => ๋ฌธ์„œ ์ƒ๋‹จ 8๊ฐœ: C4~E7, G4~H7
194
+ => ์• ๋กœ์‚ฌํ•ญ/๋ชฉํ‘œ: D11, D22
195
+ => SWOT(4์ค„): D45, D54, D63, D72
196
+ => ์žฌ๋ฌด(4์ค„): E87..E90
197
+ => ์ƒ๊ถŒ(1์ค„): D101
198
+ => ์‚ฌ์ง„(๊ฐ€๋กœ/์„ธ๋กœ๋Š” ์›ํ•˜๋Š” ๋Œ€๋กœ)
199
+ => '์ปจ์„คํŒ… ๋ชฉํ‘œ' ์…€(D22)๋งŒ ์œ„์•„๋ž˜ ๊ฐ€์šด๋ฐ ์ •๋ ฌ
200
  """
201
 
202
+ ########## 1) GPT(์• ๋กœ์‚ฌํ•ญ/๋ชฉํ‘œ)
203
  preview_difficulties, preview_goals = analyze_texts(difficulties_input, goals_input)
204
 
205
+ ########## 2) GPT(SWOT)
206
  swot_result = analyze_swot(strengths_input, weaknesses_input, opportunities_input, threats_input)
207
  swot_lines = swot_result.split("\n")
208
+ strength_line = next((line for line in swot_lines if line.startswith("๊ฐ•์ :")), "")
209
+ weakness_line = next((line for line in swot_lines if line.startswith("์•ฝ์ :")), "")
210
+ opportunity_line = next((line for line in swot_lines if line.startswith("๊ธฐํšŒ:")), "")
211
+ threat_line = next((line for line in swot_lines if line.startswith("์œ„ํ˜‘:")), "")
212
 
213
+ ########## 3) GPT(์žฌ๋ฌด)
214
  fin_result = analyze_financials(
215
  avg_monthly_sales, rent, labor_cost, management_cost,
216
  utilities, current_interest, other_cost, cost_ratio
217
  )
218
+ lines = fin_result.split("\n")
219
 
220
+ ########## 4) GPT(์ƒ๊ถŒ)
221
  market_result = analyze_market(region_input, industry_input)
222
 
223
+ ########## ์ด ์•„๋ž˜๋Š” EXE.xlsx ๊ธฐ๋ก
224
  wb = load_workbook("EXE.xlsx")
225
  ws = wb.active
226
 
 
257
  ws["G7"] = consulting_region
258
  ws["G7"].alignment = Alignment(horizontal="center", vertical="center")
259
 
260
+ # (B) ์• ๋กœ์‚ฌํ•ญ/๋ชฉํ‘œ
261
  ws["D11"] = preview_difficulties
262
  ws["D11"].alignment = Alignment(wrap_text=True)
263
+
264
  ws["D22"] = preview_goals
265
+ # (โ˜…) ์ปจ์„คํŒ… ๋ชฉํ‘œ ์ถœ๋ ฅ๋ž€(D22) ์œ„์•„๋ž˜(์ˆ˜์ง) + ์ขŒ์šฐ(์ˆ˜ํ‰) ๊ฐ€์šด๋ฐ ์ •๋ ฌ
266
+ ws["D22"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
267
 
268
+ # (F) ์‚ฌ์ง„(์˜ˆ: 5ร—5cm)
269
  if photo1 is not None:
270
  img1_bytes = BytesIO()
271
  photo1.save(img1_bytes, format="PNG")
272
  img1_bytes.seek(0)
273
  img_for_excel_1 = ExcelImage(img1_bytes)
274
+ img_for_excel_1.width = int(37.79 * 5)
275
+ img_for_excel_1.height = int(37.79 * 5)
276
  ws.add_image(img_for_excel_1, "B117")
277
 
278
  if photo2 is not None:
 
280
  photo2.save(img2_bytes, format="PNG")
281
  img2_bytes.seek(0)
282
  img_for_excel_2 = ExcelImage(img2_bytes)
283
+ img_for_excel_2.width = int(37.79 * 5)
284
+ img_for_excel_2.height = int(37.79 * 5)
285
  ws.add_image(img_for_excel_2, "F117")
286
 
287
+ # (C) SWOT ๊ฒฐ๊ณผ(4์นธ)
288
  ws.merge_cells("D45:H45")
289
  ws["D45"] = strength_line
290
  ws["D45"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
 
301
  ws["D72"] = threat_line
302
  ws["D72"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
303
 
304
+ # (D) ์žฌ๋ฌด๋ถ„์„ ๊ฒฐ๊ณผ -> E87:E90 (4์ค„)
305
+ ws.merge_cells("E87:G87")
306
+ ws["E87"] = lines[0] if len(lines) > 0 else ""
307
+ ws["E87"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
308
+
309
+ ws.merge_cells("E88:G88")
310
+ ws["E88"] = lines[1] if len(lines) > 1 else ""
311
+ ws["E88"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
312
+
313
+ ws.merge_cells("E89:G89")
314
+ ws["E89"] = lines[2] if len(lines) > 2 else ""
315
+ ws["E89"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
316
+
317
+ ws.merge_cells("E90:G90")
318
+ ws["E90"] = lines[3] if len(lines) > 3 else ""
319
+ ws["E90"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
320
+
321
+ # (E) ์ƒ๊ถŒ๋ถ„์„ ๊ฒฐ๊ณผ -> D101:H101
 
 
 
 
 
322
  ws.merge_cells("D101:H101")
323
  ws["D101"] = market_result
324
  ws["D101"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
 
366
 
367
  gr.Markdown("---")
368
 
369
+ # (C) SWOT
370
  strengths_input = gr.Textbox(label="๊ฐ•์ ")
371
  weaknesses_input = gr.Textbox(label="์•ฝ์ ")
372
  opportunities_input = gr.Textbox(label="๊ธฐํšŒ")
 
374
 
375
  gr.Markdown("---")
376
 
377
+ # (D) ์žฌ๋ฌด
378
  with gr.Row():
379
  avg_monthly_sales_input = gr.Textbox(label="์›”ํ‰๊ท ๋งค์ถœ์•ก")
380
  rent_input = gr.Textbox(label="์ž„์ฐจ๋ฃŒ")
 
395
 
396
  gr.Markdown("---")
397
 
398
+ # (F) ์‚ฌ์ง„
399
  with gr.Row():
400
  photo_input_1 = gr.Image(label="์ˆ˜์ง„์—…์ฒด์‚ฌ์ง„1", type="pil")
401
  photo_input_2 = gr.Image(label="์ˆ˜์ง„์—…์ฒด์‚ฌ์ง„2", type="pil")
 
423
  difficulties_input,
424
  goals_input,
425
 
426
+ # (C)
427
  strengths_input,
428
  weaknesses_input,
429
  opportunities_input,
430
  threats_input,
431
 
432
+ # (D)
433
  avg_monthly_sales_input,
434
  rent_input,
435
  labor_cost_input,