tkdehf2 commited on
Commit
dc76965
Β·
verified Β·
1 Parent(s): 4a6cb40

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -31,18 +31,23 @@ def generate_diary(emotion, num_samples=1, max_length=100, temperature=0.7):
31
  return [tokenizer.decode(output_sequence, skip_special_tokens=True) for output_sequence in output]
32
 
33
  def main():
 
34
  while True:
35
  # μ‚¬μš©μžλ‘œλΆ€ν„° 감정 μž…λ ₯ λ°›κΈ°
36
  try:
37
- emotion = input("였늘의 감정을 μž…λ ₯ν•˜μ„Έμš” (happy, sad, angry λ“±): ")
38
  if emotion.lower() in ['happy', 'sad', 'angry']:
39
  break
40
  else:
41
  print("μž…λ ₯된 감정이 잘λͺ»λ˜μ—ˆμŠ΅λ‹ˆλ‹€. λ‹€μ‹œ μž…λ ₯ν•΄μ£Όμ„Έμš”.")
42
- except EOFError:
43
- print("\nμ‚¬μš©μž μž…λ ₯이 μ’…λ£Œλ˜μ—ˆμŠ΅λ‹ˆλ‹€. ν”„λ‘œκ·Έλž¨μ„ μ’…λ£Œν•©λ‹ˆλ‹€.")
44
  return
45
 
 
 
 
 
46
  # 일기 생성
47
  diary_entries = generate_diary(emotion)
48
  # μƒμ„±λœ 일기 좜λ ₯
 
31
  return [tokenizer.decode(output_sequence, skip_special_tokens=True) for output_sequence in output]
32
 
33
  def main():
34
+ print("감정 μž…λ ₯을 μ‹œμž‘ν•©λ‹ˆλ‹€.")
35
  while True:
36
  # μ‚¬μš©μžλ‘œλΆ€ν„° 감정 μž…λ ₯ λ°›κΈ°
37
  try:
38
+ emotion = input("였늘의 감정을 μž…λ ₯ν•˜μ„Έμš” (happy, sad, angry λ“±): ").strip() # μž…λ ₯ λ¬Έμžμ—΄μ˜ μ•žλ’€ 곡백 제거
39
  if emotion.lower() in ['happy', 'sad', 'angry']:
40
  break
41
  else:
42
  print("μž…λ ₯된 감정이 잘λͺ»λ˜μ—ˆμŠ΅λ‹ˆλ‹€. λ‹€μ‹œ μž…λ ₯ν•΄μ£Όμ„Έμš”.")
43
+ except KeyboardInterrupt:
44
+ print("\nμ‚¬μš©μžκ°€ μž…λ ₯을 μ·¨μ†Œν–ˆμŠ΅λ‹ˆλ‹€. ν”„λ‘œκ·Έλž¨μ„ μ’…λ£Œν•©λ‹ˆλ‹€.")
45
  return
46
 
47
+ # 빈 λ¬Έμžμ—΄μ΄ μž…λ ₯λ˜μ—ˆμ„ λ•Œ
48
+ if not emotion:
49
+ print("감정을 μž…λ ₯ν•΄μ£Όμ„Έμš”.")
50
+
51
  # 일기 생성
52
  diary_entries = generate_diary(emotion)
53
  # μƒμ„±λœ 일기 좜λ ₯