Sangwon78 commited on
Commit
f33f87a
Β·
verified Β·
1 Parent(s): a5ae75e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -10
app.py CHANGED
@@ -40,11 +40,12 @@ def analyze_texts(difficulties, goals):
40
  preview_difficulties = call_api(
41
  content=difficulties,
42
  system_message=(
43
- "μ‚¬μš©μžκ°€ μž…λ ₯ν•œ μ• λ‘œμ‚¬ν•­μ— λŒ€ν•΄ μ΅œμ†Œ 4쀄 μ΄μƒμœΌλ‘œ, ꡬ체적으둜 뢄석 및 "
44
- "ν•΄κ²°λ°©μ•ˆμ„ μ œμ‹œν•΄μ€˜. λ¬Έμž₯은 쀑간에 λŠκΈ°μ§€ μ•Šκ³ , λΆˆν•„μš”ν•œ λ‚˜μ—΄(ν•˜λ‚˜, λ‘˜) 등을 "
45
- "λ„£μ§€ 말며, '~μŠ΅λ‹ˆλ‹€.' ν˜•νƒœλ‘œ μžμ—°μŠ€λŸ½κ²Œ λλ‚˜λ„λ‘ μž‘μ„±ν•΄μ€˜."
 
46
  ),
47
- max_tokens=150,
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=150,
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 x 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