Update app.py
Browse files
app.py
CHANGED
|
@@ -32,6 +32,7 @@ def call_api(content, system_message, max_tokens, temperature, top_p):
|
|
| 32 |
# 1) ์ ๋ก์ฌํญ/๋ชฉํ ๋ถ์
|
| 33 |
######################
|
| 34 |
def analyze_texts(difficulties, goals):
|
|
|
|
| 35 |
preview_difficulties = call_api(
|
| 36 |
content=difficulties,
|
| 37 |
system_message=(
|
|
@@ -43,6 +44,7 @@ def analyze_texts(difficulties, goals):
|
|
| 43 |
temperature=0.7,
|
| 44 |
top_p=0.9,
|
| 45 |
)
|
|
|
|
| 46 |
preview_goals = call_api(
|
| 47 |
content=goals,
|
| 48 |
system_message=(
|
|
@@ -57,19 +59,22 @@ def analyze_texts(difficulties, goals):
|
|
| 57 |
return preview_difficulties, preview_goals
|
| 58 |
|
| 59 |
######################
|
| 60 |
-
# 2) SWOT ๋ถ์
|
| 61 |
######################
|
| 62 |
def analyze_swot(strengths, weaknesses, opportunities, threats):
|
| 63 |
"""
|
| 64 |
-
๊ธฐ
|
| 65 |
-
|
| 66 |
-
๊ทธ๋๋ ์ต์ข
๊ฒฐ๊ณผ์๋ '๊ฐ์ :', '์ฝ์ :', '๊ธฐํ:', '์ํ:' 4๊ฐ ์ค๋ง ๋ถ๋ฆฌํด์ ๋ฃ์.
|
| 67 |
"""
|
| 68 |
system_message = (
|
| 69 |
"๋น์ ์ swot ๋ถ์ ์ ๋ฌธ๊ฐ์
๋๋ค. "
|
| 70 |
-
"์
๋ ฅ๋ ๊ฐ์ , ์ฝ์ , ๊ธฐํ, ์ํ์ ๊ฐ๊ฐ ์ฝ
|
| 71 |
-
"
|
| 72 |
-
"
|
|
|
|
|
|
|
|
|
|
|
|
|
| 73 |
)
|
| 74 |
content = f"""
|
| 75 |
๊ฐ์ : {strengths}
|
|
@@ -80,13 +85,13 @@ def analyze_swot(strengths, weaknesses, opportunities, threats):
|
|
| 80 |
return call_api(
|
| 81 |
content=content,
|
| 82 |
system_message=system_message,
|
| 83 |
-
max_tokens=
|
| 84 |
temperature=0.7,
|
| 85 |
top_p=1.0
|
| 86 |
)
|
| 87 |
|
| 88 |
######################
|
| 89 |
-
# 3) ์ฌ๋ฌด ๋ถ์
|
| 90 |
######################
|
| 91 |
def analyze_financials(
|
| 92 |
avg_monthly_sales,
|
|
@@ -98,38 +103,54 @@ def analyze_financials(
|
|
| 98 |
other_cost,
|
| 99 |
cost_ratio
|
| 100 |
):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 101 |
system_message = (
|
| 102 |
-
"๋น์ ์ ์ธ๋ฌด์ฌ(ํ๊ณ์ฌ)์
๋๋ค. ์๋ ์
๋ ฅ๊ฐ์
|
| 103 |
-
"์์์์ต, ์์ต๋ถ๊ธฐ์ ์
|
| 104 |
-
"
|
|
|
|
|
|
|
| 105 |
)
|
| 106 |
content = f"""
|
| 107 |
์
๋ ฅ:
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
๊ฒฐ๊ณผ ํญ๋ชฉ:
|
| 118 |
-
1)
|
| 119 |
-
2)
|
| 120 |
-
3)
|
| 121 |
-
4)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 122 |
"""
|
| 123 |
return call_api(
|
| 124 |
content=content,
|
| 125 |
system_message=system_message,
|
| 126 |
-
max_tokens=
|
| 127 |
temperature=0.7,
|
| 128 |
top_p=1.0
|
| 129 |
)
|
| 130 |
|
| 131 |
######################
|
| 132 |
-
# 4) ์๊ถ ๋ถ์
|
| 133 |
######################
|
| 134 |
def analyze_market(region, industry):
|
| 135 |
system_message = (
|
|
@@ -149,7 +170,7 @@ def analyze_market(region, industry):
|
|
| 149 |
)
|
| 150 |
|
| 151 |
######################
|
| 152 |
-
#
|
| 153 |
######################
|
| 154 |
def run_all_in_one(
|
| 155 |
# (A) ์๋จ 8๊ฐ
|
|
@@ -172,7 +193,7 @@ def run_all_in_one(
|
|
| 172 |
opportunities_input,
|
| 173 |
threats_input,
|
| 174 |
|
| 175 |
-
# (D) ์ฌ๋ฌด๋ถ์(
|
| 176 |
avg_monthly_sales,
|
| 177 |
rent,
|
| 178 |
labor_cost,
|
|
@@ -186,39 +207,41 @@ def run_all_in_one(
|
|
| 186 |
region_input,
|
| 187 |
industry_input,
|
| 188 |
|
| 189 |
-
# (F) ์ฌ์ง
|
| 190 |
photo1,
|
| 191 |
photo2
|
| 192 |
):
|
| 193 |
"""
|
| 194 |
-
-
|
| 195 |
-
-
|
| 196 |
-
- ์ฌ๋ฌด
|
| 197 |
-
- ์๊ถ
|
|
|
|
|
|
|
| 198 |
"""
|
| 199 |
|
| 200 |
-
# 1)
|
| 201 |
preview_difficulties, preview_goals = analyze_texts(difficulties_input, goals_input)
|
| 202 |
|
| 203 |
-
# 2)
|
| 204 |
swot_result = analyze_swot(strengths_input, weaknesses_input, opportunities_input, threats_input)
|
| 205 |
swot_lines = swot_result.split("\n")
|
| 206 |
-
strength_line = next((
|
| 207 |
-
weakness_line = next((
|
| 208 |
-
opportunity_line = next((
|
| 209 |
-
threat_line = next((
|
| 210 |
|
| 211 |
-
# 3)
|
| 212 |
fin_result = analyze_financials(
|
| 213 |
avg_monthly_sales, rent, labor_cost, management_cost,
|
| 214 |
utilities, current_interest, other_cost, cost_ratio
|
| 215 |
)
|
| 216 |
-
fin_lines = fin_result.split("\n")
|
| 217 |
|
| 218 |
-
# 4)
|
| 219 |
market_result = analyze_market(region_input, industry_input)
|
| 220 |
|
| 221 |
-
#
|
| 222 |
wb = load_workbook("EXE.xlsx")
|
| 223 |
ws = wb.active
|
| 224 |
|
|
@@ -255,22 +278,20 @@ def run_all_in_one(
|
|
| 255 |
ws["G7"] = consulting_region
|
| 256 |
ws["G7"].alignment = Alignment(horizontal="center", vertical="center")
|
| 257 |
|
| 258 |
-
# (B) ์ ๋ก์ฌํญ(D11), ๋ชฉํ(D22)
|
| 259 |
ws["D11"] = preview_difficulties
|
| 260 |
-
|
| 261 |
-
ws["D11"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
|
| 262 |
-
|
| 263 |
ws["D22"] = preview_goals
|
| 264 |
-
ws["D22"].alignment = Alignment(
|
| 265 |
|
| 266 |
-
# (F) ์ฌ์ง(
|
| 267 |
if photo1 is not None:
|
| 268 |
img1_bytes = BytesIO()
|
| 269 |
photo1.save(img1_bytes, format="PNG")
|
| 270 |
img1_bytes.seek(0)
|
| 271 |
img_for_excel_1 = ExcelImage(img1_bytes)
|
| 272 |
-
img_for_excel_1.width = int(37.79 *
|
| 273 |
-
img_for_excel_1.height = int(37.79 * 5)
|
| 274 |
ws.add_image(img_for_excel_1, "B117")
|
| 275 |
|
| 276 |
if photo2 is not None:
|
|
@@ -278,8 +299,8 @@ def run_all_in_one(
|
|
| 278 |
photo2.save(img2_bytes, format="PNG")
|
| 279 |
img2_bytes.seek(0)
|
| 280 |
img_for_excel_2 = ExcelImage(img2_bytes)
|
| 281 |
-
img_for_excel_2.width = int(37.79 *
|
| 282 |
-
img_for_excel_2.height = int(37.79 * 5)
|
| 283 |
ws.add_image(img_for_excel_2, "F117")
|
| 284 |
|
| 285 |
# (C) SWOT ๊ฒฐ๊ณผ (4์นธ)
|
|
@@ -299,22 +320,27 @@ def run_all_in_one(
|
|
| 299 |
ws["D72"] = threat_line
|
| 300 |
ws["D72"].alignment = Alignment(horizontal="center", vertical="center", wrap_text=True)
|
| 301 |
|
| 302 |
-
# (D) ์ฌ๋ฌด(
|
| 303 |
-
|
| 304 |
-
|
| 305 |
-
|
|
|
|
| 306 |
|
| 307 |
-
|
| 308 |
-
|
| 309 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 310 |
|
| 311 |
-
|
| 312 |
-
|
| 313 |
-
|
| 314 |
|
| 315 |
-
|
| 316 |
-
|
| 317 |
-
|
| 318 |
|
| 319 |
# (E) ์๊ถ๋ถ์(D101:H101)
|
| 320 |
ws.merge_cells("D101:H101")
|
|
@@ -364,7 +390,7 @@ def main():
|
|
| 364 |
|
| 365 |
gr.Markdown("---")
|
| 366 |
|
| 367 |
-
# (C) SWOT
|
| 368 |
strengths_input = gr.Textbox(label="๊ฐ์ ")
|
| 369 |
weaknesses_input = gr.Textbox(label="์ฝ์ ")
|
| 370 |
opportunities_input = gr.Textbox(label="๊ธฐํ")
|
|
@@ -372,7 +398,7 @@ def main():
|
|
| 372 |
|
| 373 |
gr.Markdown("---")
|
| 374 |
|
| 375 |
-
# (D) ์ฌ๋ฌด
|
| 376 |
with gr.Row():
|
| 377 |
avg_monthly_sales_input = gr.Textbox(label="์ํ๊ท ๋งค์ถ์ก")
|
| 378 |
rent_input = gr.Textbox(label="์์ฐจ๋ฃ")
|
|
@@ -393,14 +419,14 @@ def main():
|
|
| 393 |
|
| 394 |
gr.Markdown("---")
|
| 395 |
|
| 396 |
-
# (F) ์ฌ์ง
|
| 397 |
with gr.Row():
|
| 398 |
photo_input_1 = gr.Image(label="์์ง์
์ฒด์ฌ์ง1", type="pil")
|
| 399 |
photo_input_2 = gr.Image(label="์์ง์
์ฒด์ฌ์ง2", type="pil")
|
| 400 |
|
| 401 |
gr.Markdown("---")
|
| 402 |
|
| 403 |
-
# ๋ฒํผ
|
| 404 |
all_in_one_button = gr.Button("๋ชจ๋ ์
๋ ฅ ํ, Excel ๋ค์ด๋ก๋")
|
| 405 |
all_in_one_file = gr.File(label="๋ค์ด๋ก๋(ํด๋ฆญ ํ ์ ์ฅ)")
|
| 406 |
|
|
@@ -421,13 +447,13 @@ def main():
|
|
| 421 |
difficulties_input,
|
| 422 |
goals_input,
|
| 423 |
|
| 424 |
-
# (C)
|
| 425 |
strengths_input,
|
| 426 |
weaknesses_input,
|
| 427 |
opportunities_input,
|
| 428 |
threats_input,
|
| 429 |
|
| 430 |
-
# (D)
|
| 431 |
avg_monthly_sales_input,
|
| 432 |
rent_input,
|
| 433 |
labor_cost_input,
|
|
|
|
| 32 |
# 1) ์ ๋ก์ฌํญ/๋ชฉํ ๋ถ์
|
| 33 |
######################
|
| 34 |
def analyze_texts(difficulties, goals):
|
| 35 |
+
# ์ ๋ก์ฌํญ
|
| 36 |
preview_difficulties = call_api(
|
| 37 |
content=difficulties,
|
| 38 |
system_message=(
|
|
|
|
| 44 |
temperature=0.7,
|
| 45 |
top_p=0.9,
|
| 46 |
)
|
| 47 |
+
# ์ปจ์คํ
๋ชฉํ
|
| 48 |
preview_goals = call_api(
|
| 49 |
content=goals,
|
| 50 |
system_message=(
|
|
|
|
| 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 |
+
"์
๋ ฅ๋ ๊ฐ์ , ์ฝ์ , ๊ธฐํ, ์ํ์ ๊ฐ๊ฐ ์์ฝํด ์ฃผ์ธ์. "
|
| 72 |
+
"์ถ๋ ฅ์ ๋ฐ๋์ ์๋ ์์ ํํ๋ก 4์ค๋ง ์์ฑํฉ๋๋ค:\n\n"
|
| 73 |
+
"๊ฐ์ : ~~~\n"
|
| 74 |
+
"์ฝ์ : ~~~\n"
|
| 75 |
+
"๊ธฐํ: ~~~\n"
|
| 76 |
+
"์ํ: ~~~\n\n"
|
| 77 |
+
"ํญ์ '๊ฐ์ :', '์ฝ์ :', '๊ธฐํ:', '์ํ:'์ผ๋ก ์์ํ๋ 4์ค๋ก๋ง ์๋ตํด ์ฃผ์ธ์."
|
| 78 |
)
|
| 79 |
content = f"""
|
| 80 |
๊ฐ์ : {strengths}
|
|
|
|
| 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 |
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 |
)
|
| 171 |
|
| 172 |
######################
|
| 173 |
+
# run_all_in_one
|
| 174 |
######################
|
| 175 |
def run_all_in_one(
|
| 176 |
# (A) ์๋จ 8๊ฐ
|
|
|
|
| 193 |
opportunities_input,
|
| 194 |
threats_input,
|
| 195 |
|
| 196 |
+
# (D) ์ฌ๋ฌด๋ถ์ (12๊ฐ ํญ๋ชฉ ์ถ๋ ฅ)
|
| 197 |
avg_monthly_sales,
|
| 198 |
rent,
|
| 199 |
labor_cost,
|
|
|
|
| 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 |
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 |
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์นธ)
|
|
|
|
| 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")
|
|
|
|
| 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 |
|
| 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 |
|
| 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")
|
| 426 |
|
| 427 |
gr.Markdown("---")
|
| 428 |
|
| 429 |
+
# ํ๋์ ๋ฒํผ
|
| 430 |
all_in_one_button = gr.Button("๋ชจ๋ ์
๋ ฅ ํ, Excel ๋ค์ด๋ก๋")
|
| 431 |
all_in_one_file = gr.File(label="๋ค์ด๋ก๋(ํด๋ฆญ ํ ์ ์ฅ)")
|
| 432 |
|
|
|
|
| 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,
|