Update app.py
Browse files
app.py
CHANGED
|
@@ -40,11 +40,12 @@ def analyze_texts(difficulties, goals):
|
|
| 40 |
preview_difficulties = call_api(
|
| 41 |
content=difficulties,
|
| 42 |
system_message=(
|
| 43 |
-
"μ¬μ©μκ° μ
λ ₯ν μ λ‘μ¬ν
|
| 44 |
-
"
|
| 45 |
-
"
|
|
|
|
| 46 |
),
|
| 47 |
-
max_tokens=
|
| 48 |
temperature=0.7,
|
| 49 |
top_p=0.9,
|
| 50 |
)
|
|
@@ -53,11 +54,12 @@ def analyze_texts(difficulties, goals):
|
|
| 53 |
preview_goals = call_api(
|
| 54 |
content=goals,
|
| 55 |
system_message=(
|
| 56 |
-
"μ¬μ©μκ° μ
λ ₯ν 컨μ€ν
λͺ©νλ₯Ό μ΅μ 4μ€ μ΄μμΌλ‘
|
| 57 |
-
"
|
| 58 |
-
"
|
|
|
|
| 59 |
),
|
| 60 |
-
max_tokens=
|
| 61 |
temperature=0.7,
|
| 62 |
top_p=0.9,
|
| 63 |
)
|
|
@@ -71,17 +73,19 @@ def generate_excel(photo1, photo2, preview_difficulties, preview_goals):
|
|
| 71 |
wb = load_workbook("EXE.xlsx")
|
| 72 |
ws = wb.active
|
| 73 |
|
| 74 |
-
# ν
μ€νΈ
|
| 75 |
ws["D11"] = preview_difficulties
|
| 76 |
ws["D22"] = preview_goals
|
| 77 |
|
|
|
|
| 78 |
ws["D11"].alignment = Alignment(wrap_text=True)
|
| 79 |
ws["D22"].alignment = Alignment(wrap_text=True)
|
| 80 |
|
|
|
|
| 81 |
for col in ["D", "E", "F", "G", "H"]:
|
| 82 |
ws.column_dimensions[col].width = 8.4
|
| 83 |
|
| 84 |
-
# μ¬μ§(5cm
|
| 85 |
width_px = int(37.79 * 5)
|
| 86 |
height_px = int(37.79 * 5)
|
| 87 |
|
|
@@ -89,6 +93,7 @@ def generate_excel(photo1, photo2, preview_difficulties, preview_goals):
|
|
| 89 |
img1_bytes = BytesIO()
|
| 90 |
photo1.save(img1_bytes, format="PNG")
|
| 91 |
img1_bytes.seek(0)
|
|
|
|
| 92 |
img1_for_excel = ExcelImage(img1_bytes)
|
| 93 |
img1_for_excel.width = width_px
|
| 94 |
img1_for_excel.height = height_px
|
|
@@ -98,6 +103,7 @@ def generate_excel(photo1, photo2, preview_difficulties, preview_goals):
|
|
| 98 |
img2_bytes = BytesIO()
|
| 99 |
photo2.save(img2_bytes, format="PNG")
|
| 100 |
img2_bytes.seek(0)
|
|
|
|
| 101 |
img2_for_excel = ExcelImage(img2_bytes)
|
| 102 |
img2_for_excel.width = width_px
|
| 103 |
img2_for_excel.height = height_px
|
|
|
|
| 40 |
preview_difficulties = call_api(
|
| 41 |
content=difficulties,
|
| 42 |
system_message=(
|
| 43 |
+
"μ¬μ©μκ° μ
λ ₯ν μ λ‘μ¬νμ μ΅μ 4μ€ μ΄μμΌλ‘ ꡬ체μ μΌλ‘ μμ±ν΄μ€. "
|
| 44 |
+
"λ¬Έμ₯μ κΈμ μ€κ°μ λκ±°λ μλ₯΄μ§ λ§κ³ , λΆνμν λμ΄(μ: νλ, λ λ±)μ "
|
| 45 |
+
"μ¬μ©νμ§ λ§λ©°, '~μ΅λλ€.' ννλ‘ μμ°μ€λ½κ² λλ΄μ€. νμνλ€λ©΄ κΈμ΄ κΈΈμ΄λ μ’μΌλ "
|
| 46 |
+
"μ€κ°μ΄ λκΈ°μ§ μλλ‘ μλ£λ λ¬Έμ₯μ μμ±ν΄."
|
| 47 |
),
|
| 48 |
+
max_tokens=400, # μΆ©λΆν κΈ΄ λ΅λ³μ μν΄ max_tokens ν¬κ² μ€μ
|
| 49 |
temperature=0.7,
|
| 50 |
top_p=0.9,
|
| 51 |
)
|
|
|
|
| 54 |
preview_goals = call_api(
|
| 55 |
content=goals,
|
| 56 |
system_message=(
|
| 57 |
+
"μ¬μ©μκ° μ
λ ₯ν 컨μ€ν
λͺ©νλ₯Ό μ΅μ 4μ€ μ΄μμΌλ‘ ꡬ체μ μΌλ‘ μμ±ν΄μ€. "
|
| 58 |
+
"λ¬Έμ₯μ κΈμ μ€κ°μ λκ±°λ μλ₯΄μ§ λ§κ³ , λΆνμν λμ΄(μ: νλ, λ λ±)μ "
|
| 59 |
+
"μ¬μ©νμ§ λ§λ©°, '~μ΅λλ€.' ννλ‘ μμ°μ€λ½κ² λλ΄μ€. νμνλ€λ©΄ κΈμ΄ κΈΈμ΄λ μ’μΌλ "
|
| 60 |
+
"μ€κ°μ΄ λκΈ°μ§ μλλ‘ μλ£λ λ¬Έμ₯μ μμ±ν΄."
|
| 61 |
),
|
| 62 |
+
max_tokens=400,
|
| 63 |
temperature=0.7,
|
| 64 |
top_p=0.9,
|
| 65 |
)
|
|
|
|
| 73 |
wb = load_workbook("EXE.xlsx")
|
| 74 |
ws = wb.active
|
| 75 |
|
| 76 |
+
# μ λ‘μ¬ν, λͺ©ν ν
μ€νΈ
|
| 77 |
ws["D11"] = preview_difficulties
|
| 78 |
ws["D22"] = preview_goals
|
| 79 |
|
| 80 |
+
# μ€λ°κΏ μ€μ
|
| 81 |
ws["D11"].alignment = Alignment(wrap_text=True)
|
| 82 |
ws["D22"].alignment = Alignment(wrap_text=True)
|
| 83 |
|
| 84 |
+
# μ΄ λλΉ μ€μ
|
| 85 |
for col in ["D", "E", "F", "G", "H"]:
|
| 86 |
ws.column_dimensions[col].width = 8.4
|
| 87 |
|
| 88 |
+
# μ¬μ§ (5cm Γ 5cm)
|
| 89 |
width_px = int(37.79 * 5)
|
| 90 |
height_px = int(37.79 * 5)
|
| 91 |
|
|
|
|
| 93 |
img1_bytes = BytesIO()
|
| 94 |
photo1.save(img1_bytes, format="PNG")
|
| 95 |
img1_bytes.seek(0)
|
| 96 |
+
|
| 97 |
img1_for_excel = ExcelImage(img1_bytes)
|
| 98 |
img1_for_excel.width = width_px
|
| 99 |
img1_for_excel.height = height_px
|
|
|
|
| 103 |
img2_bytes = BytesIO()
|
| 104 |
photo2.save(img2_bytes, format="PNG")
|
| 105 |
img2_bytes.seek(0)
|
| 106 |
+
|
| 107 |
img2_for_excel = ExcelImage(img2_bytes)
|
| 108 |
img2_for_excel.width = width_px
|
| 109 |
img2_for_excel.height = height_px
|