ll7098ll commited on
Commit
09eed91
ยท
verified ยท
1 Parent(s): be2869a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -11
app.py CHANGED
@@ -273,20 +273,22 @@ CoT ํ”„๋กฌํ”„ํŠธ (๋ฉ€ํ‹ฐ ์—์ด์ „ํŠธ AI ์‹œ์Šคํ…œ ์‹œ๋ฎฌ๋ ˆ์ด์…˜)
273
  """
274
 
275
 
276
- def generate_curriculum(learning_objective, learner_characteristics): # learning_objective, learner_characteristics ์ธ์ž ์ถ”๊ฐ€
277
  full_text = ""
278
- output_area.markdown("## CoT ๊ธฐ๋ฐ˜ ๊ฐœ๋ณ„ํ™” ํ•™์Šต ์„ค๊ณ„ ์‹œ๋ฎฌ๋ ˆ์ด์…˜ ๊ฒฐ๊ณผ") # ์ œ๋ชฉ ๋ณ€๊ฒฝ
279
 
280
- # CoT ํ”„๋กฌํ”„ํŠธ ๋‹จ๊ณ„๋ณ„ ์ง€์‹œ ๋ถ„๋ฆฌ
281
- cot_steps = SYSTEM_PROMPT.format(learning_objective=learning_objective, learner_characteristics=learner_characteristics).split("[๋‹จ๊ณ„ ") # prompt ํ…œํ”Œ๋ฆฟ ์ ์šฉ ๋ฐ ๋ถ„๋ฆฌ
282
- cot_steps = cot_steps[1:] # ์ฒซ ๋ฒˆ์งธ ๋นˆ ๋ฌธ์ž์—ด ์š”์†Œ ์ œ๊ฑฐ
283
 
284
  for step_prompt_part in cot_steps:
285
- step_number = step_prompt_part[0] # ๋‹จ๊ณ„ ๋ฒˆํ˜ธ ์ถ”์ถœ
286
- step_content = "[๋‹จ๊ณ„ " + step_prompt_part # "[๋‹จ๊ณ„ X] ..." ํ˜•ํƒœ๋กœ ์žฌ๊ตฌ์„ฑ
287
 
288
- # ๋‹จ๊ณ„๋ณ„ ํ”„๋กฌํ”„ํŠธ ์ „์†ก ๋ฐ ์‘๋‹ต ์ฒ˜๋ฆฌ
289
  try:
 
 
 
 
290
  prompt = [step_content]
291
  prompt = "\n".join(prompt)
292
 
@@ -294,11 +296,11 @@ def generate_curriculum(learning_objective, learner_characteristics): # learning
294
  step_output = ""
295
  for chunk in response:
296
  step_output += chunk.text
297
- full_text += chunk.text # ์ „์ฒด ํ…์ŠคํŠธ ๋ˆ„์ 
298
  html_text = markdown.markdown(full_text, extensions=['tables', 'fenced_code'])
299
  output_area.markdown(html_text, unsafe_allow_html=True)
300
- time.sleep(0.02) # ์ŠคํŠธ๋ฆฌ๋ฐ ์†๋„ ์กฐ์ ˆ
301
- full_text += "\n\n" # ๋‹จ๊ณ„ ๊ตฌ๋ถ„์„ ์œ„ํ•œ ๊ณต๋ฐฑ ์ถ”๊ฐ€
302
 
303
  except Exception as e:
304
  st.error(f"๊ณ„ํš์„œ ์ƒ์„ฑ ์˜ค๋ฅ˜ (๋‹จ๊ณ„ {step_number}): {e}")
 
273
  """
274
 
275
 
276
+ def generate_curriculum(learning_objective, learner_characteristics):
277
  full_text = ""
278
+ output_area.markdown("## CoT ๊ธฐ๋ฐ˜ ๊ฐœ๋ณ„ํ™” ํ•™์Šต ์„ค๊ณ„ ์‹œ๋ฎฌ๋ ˆ์ด์…˜ ๊ฒฐ๊ณผ")
279
 
280
+ cot_steps = SYSTEM_PROMPT.format(learning_objective=learning_objective, learner_characteristics=learner_characteristics).split("[๋‹จ๊ณ„ ")
281
+ cot_steps = cot_steps[1:]
 
282
 
283
  for step_prompt_part in cot_steps:
284
+ step_number = step_prompt_part[0]
285
+ step_content = "[๋‹จ๊ณ„ " + step_prompt_part
286
 
 
287
  try:
288
+ # **[์ˆ˜์ •] ํ”„๋กฌํ”„ํŠธ ๋‚ด์šฉ ์ถœ๋ ฅ (๋””๋ฒ„๊น…์šฉ)**
289
+ print(f"\n--- ๋‹จ๊ณ„ {step_number} ํ”„๋กฌํ”„ํŠธ ---")
290
+ print(step_content)
291
+
292
  prompt = [step_content]
293
  prompt = "\n".join(prompt)
294
 
 
296
  step_output = ""
297
  for chunk in response:
298
  step_output += chunk.text
299
+ full_text += chunk.text
300
  html_text = markdown.markdown(full_text, extensions=['tables', 'fenced_code'])
301
  output_area.markdown(html_text, unsafe_allow_html=True)
302
+ time.sleep(0.02)
303
+ full_text += "\n\n"
304
 
305
  except Exception as e:
306
  st.error(f"๊ณ„ํš์„œ ์ƒ์„ฑ ์˜ค๋ฅ˜ (๋‹จ๊ณ„ {step_number}): {e}")