JUNGU commited on
Commit
18d68ba
β€’
1 Parent(s): 62c0e70

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -24
app.py CHANGED
@@ -17,8 +17,6 @@ def main():
17
  반면 의무 νˆ¬ν‘œμ œμ— λ°˜λŒ€ν•˜λŠ” 츑은 ν˜„μž¬ μš°λ¦¬λ‚˜λΌμ˜ νˆ¬ν‘œμœ¨μ΄ μ •μΉ˜ μ§€λ„μžλ“€μ˜ λŒ€ν‘œμ„±μ„ 훼손할 만큼 μ‹¬κ°ν•œ 상황은 μ•„λ‹ˆλΌκ³  μ£Όμž₯ν•œλ‹€. 또 νˆ¬ν‘œμœ¨μ„ λ†’μ΄λŠ” 것보닀 ꡭ민의 μ‹ λ’°λ₯Ό νšŒλ³΅ν•˜λŠ” 것이 더 μ€‘μš”ν•˜κ³ , μ‹œλ―Ό κ΅μœ‘μ΄λ‚˜ λͺ¨μ˜ νˆ¬ν‘œ ꡐ윑 ν”„λ‘œκ·Έλž¨μœΌλ‘œλ„ νˆ¬ν‘œμœ¨ μƒμŠΉμ„ κΈ°λŒ€ν•  수 μžˆλ‹€λ©° 의무 νˆ¬ν‘œμ œμ˜ λ„μž…λ§Œμ΄ νˆ¬ν‘œμœ¨μ΄λ‚˜ μ •μΉ˜μ  관심을 λ†’μ΄λŠ” ν•΄κ²° λ°©μ•ˆμ€ μ•„λ‹ˆλΌκ³  μ΄μ•ΌκΈ°ν•œλ‹€. 그리고 의무 νˆ¬ν‘œμ œλ₯Ό λ„μž…ν•˜λ©΄, μ„ μΆœλœ μ •μΉ˜μΈλ“€μ΄ 높은 νˆ¬ν‘œμœ¨μ„ ν•‘κ³„λ‘œ μ•ˆν•˜λ¬΄μΈμ˜ νƒœλ„λ₯Ό κ°–λŠ” λΆ€μž‘μš©μ΄ 생긴닀든가 ν›„λ³΄μžλ₯Ό 잘 λͺ¨λ₯΄λŠ” μƒνƒœμ—μ„œ νˆ¬ν‘œν•˜λŠ” 일이 λ°œμƒν•˜μ—¬ ꡭ민의 뜻이 였히렀 μ™œκ³‘λ  수 μžˆλ‹€λ©° 우렀의 λͺ©μ†Œλ¦¬λ₯Ό λ‚΄κ³  μžˆλ‹€.
18
  """
19
 
20
- # ν…μŠ€νŠΈ μž…λ ₯ λ°•μŠ€ μΆ”κ°€
21
- user_input = st.text_input("λͺ¨λ₯΄λŠ” λ¬Έμž₯μ΄λ‚˜ 단어λ₯Ό μž…λ ₯ν•˜μ„Έμš”:", "")
22
 
23
  st.text("지문:")
24
  st.write(user_text)
@@ -59,29 +57,30 @@ def main():
59
 
60
  exec(highlighted_text)
61
 
62
- if user_input:
63
- # μž…λ ₯된 ν…μŠ€νŠΈ μ„€λͺ…
64
- explanation_task = f"Explain the term '{user_input}' in a simple manner, based on the context of the following passage: {user_text}"
65
-
66
- messages = [
67
- {"role": "system", "content": "You are a helpful assistant that explains complex topics in a way that an elementary school student can understand."},
68
- {"role": "user", "content": explanation_task}
69
- ]
70
-
71
- response = openai.ChatCompletion.create(
72
- model="gpt-3.5-turbo-16k",
73
- messages=messages,
74
- temperature=0.1,
75
- max_tokens=150
76
- )
77
-
78
- explanation = response['choices'][0]['message']['content']
79
-
80
- # μ‰¬μš΄ ν‘œν˜„μœΌλ‘œ κ²°κ³Ό 좜λ ₯
81
- st.text("μ„€λͺ…:")
82
- st.write(explanation)
83
-
84
 
 
 
 
85
 
86
  if __name__ == "__main__":
87
  main()
 
17
  반면 의무 νˆ¬ν‘œμ œμ— λ°˜λŒ€ν•˜λŠ” 츑은 ν˜„μž¬ μš°λ¦¬λ‚˜λΌμ˜ νˆ¬ν‘œμœ¨μ΄ μ •μΉ˜ μ§€λ„μžλ“€μ˜ λŒ€ν‘œμ„±μ„ 훼손할 만큼 μ‹¬κ°ν•œ 상황은 μ•„λ‹ˆλΌκ³  μ£Όμž₯ν•œλ‹€. 또 νˆ¬ν‘œμœ¨μ„ λ†’μ΄λŠ” 것보닀 ꡭ민의 μ‹ λ’°λ₯Ό νšŒλ³΅ν•˜λŠ” 것이 더 μ€‘μš”ν•˜κ³ , μ‹œλ―Ό κ΅μœ‘μ΄λ‚˜ λͺ¨μ˜ νˆ¬ν‘œ ꡐ윑 ν”„λ‘œκ·Έλž¨μœΌλ‘œλ„ νˆ¬ν‘œμœ¨ μƒμŠΉμ„ κΈ°λŒ€ν•  수 μžˆλ‹€λ©° 의무 νˆ¬ν‘œμ œμ˜ λ„μž…λ§Œμ΄ νˆ¬ν‘œμœ¨μ΄λ‚˜ μ •μΉ˜μ  관심을 λ†’μ΄λŠ” ν•΄κ²° λ°©μ•ˆμ€ μ•„λ‹ˆλΌκ³  μ΄μ•ΌκΈ°ν•œλ‹€. 그리고 의무 νˆ¬ν‘œμ œλ₯Ό λ„μž…ν•˜λ©΄, μ„ μΆœλœ μ •μΉ˜μΈλ“€μ΄ 높은 νˆ¬ν‘œμœ¨μ„ ν•‘κ³„λ‘œ μ•ˆν•˜λ¬΄μΈμ˜ νƒœλ„λ₯Ό κ°–λŠ” λΆ€μž‘μš©μ΄ 생긴닀든가 ν›„λ³΄μžλ₯Ό 잘 λͺ¨λ₯΄λŠ” μƒνƒœμ—μ„œ νˆ¬ν‘œν•˜λŠ” 일이 λ°œμƒν•˜μ—¬ ꡭ민의 뜻이 였히렀 μ™œκ³‘λ  수 μžˆλ‹€λ©° 우렀의 λͺ©μ†Œλ¦¬λ₯Ό λ‚΄κ³  μžˆλ‹€.
18
  """
19
 
 
 
20
 
21
  st.text("지문:")
22
  st.write(user_text)
 
57
 
58
  exec(highlighted_text)
59
 
60
+ # ν…μŠ€νŠΈ μž…λ ₯ λ°•μŠ€ μΆ”κ°€
61
+ user_input = st.text_input("λͺ¨λ₯΄λŠ” λ¬Έμž₯μ΄λ‚˜ 단어λ₯Ό μž…λ ₯ν•˜μ„Έμš”:", "")
62
+ # ν…μŠ€νŠΈ λ²„νŠΌ μΆ”κ°€
63
+ if st.button("μΆ”κ°€ μ„€λͺ…"):
64
+ # μž…λ ₯된 ν…μŠ€νŠΈ μ„€λͺ…
65
+ explanation_task = f"Explain the term '{user_input}' in a simple manner, based on the context of the following passage: {user_text}"
66
+
67
+ messages = [
68
+ {"role": "system", "content": "You are a helpful assistant that explains complex topics in a way that an elementary school student can understand."},
69
+ {"role": "user", "content": explanation_task}
70
+ ]
71
+
72
+ response = openai.ChatCompletion.create(
73
+ model="gpt-3.5-turbo-16k",
74
+ messages=messages,
75
+ temperature=0.1,
76
+ max_tokens=150
77
+ )
78
+
79
+ explanation = response['choices'][0]['message']['content']
 
 
80
 
81
+ # μ‰¬μš΄ ν‘œν˜„μœΌλ‘œ κ²°κ³Ό 좜λ ₯
82
+ st.text("μ„€λͺ…:")
83
+ st.write(explanation)
84
 
85
  if __name__ == "__main__":
86
  main()