Update app.py
Browse files
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
|
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 |
# μμ±λ μΌκΈ° μΆλ ₯
|