JUNGU commited on
Commit
a54dce8
β€’
1 Parent(s): 1e7b809

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -3
app.py CHANGED
@@ -25,15 +25,16 @@ def main():
25
  반면 의무 νˆ¬ν‘œμ œμ— λ°˜λŒ€ν•˜λŠ” 츑은 ν˜„μž¬ μš°λ¦¬λ‚˜λΌμ˜ νˆ¬ν‘œμœ¨μ΄ μ •μΉ˜ μ§€λ„μžλ“€μ˜ λŒ€ν‘œμ„±μ„ 훼손할 만큼 μ‹¬κ°ν•œ 상황은 μ•„λ‹ˆλΌκ³  μ£Όμž₯ν•œλ‹€. 또 νˆ¬ν‘œμœ¨μ„ λ†’μ΄λŠ” 것보닀 ꡭ민의 μ‹ λ’°λ₯Ό νšŒλ³΅ν•˜λŠ” 것이 더 μ€‘μš”ν•˜κ³ , μ‹œλ―Ό κ΅μœ‘μ΄λ‚˜ λͺ¨μ˜ νˆ¬ν‘œ ꡐ윑 ν”„λ‘œκ·Έλž¨μœΌλ‘œλ„ νˆ¬ν‘œμœ¨ μƒμŠΉμ„ κΈ°λŒ€ν•  수 μžˆλ‹€λ©° 의무 νˆ¬ν‘œμ œμ˜ λ„μž…λ§Œμ΄ νˆ¬ν‘œμœ¨μ΄λ‚˜ μ •μΉ˜μ  관심을 λ†’μ΄λŠ” ν•΄κ²° λ°©μ•ˆμ€ μ•„λ‹ˆλΌκ³  μ΄μ•ΌκΈ°ν•œλ‹€. 그리고 의무 νˆ¬ν‘œμ œλ₯Ό λ„μž…ν•˜λ©΄, μ„ μΆœλœ μ •μΉ˜μΈλ“€μ΄ 높은 νˆ¬ν‘œμœ¨μ„ ν•‘κ³„λ‘œ μ•ˆν•˜λ¬΄μΈμ˜ νƒœλ„λ₯Ό κ°–λŠ” λΆ€μž‘μš©μ΄ 생긴닀든가 ν›„λ³΄μžλ₯Ό 잘 λͺ¨λ₯΄λŠ” μƒνƒœμ—μ„œ νˆ¬ν‘œν•˜λŠ” 일이 λ°œμƒν•˜μ—¬ ꡭ민의 뜻이 였히렀 μ™œκ³‘λ  수 μžˆλ‹€λ©° 우렀의 λͺ©μ†Œλ¦¬λ₯Ό λ‚΄κ³  μžˆλ‹€.
26
  """
27
  text_placeholder.write(user_text)
28
- st.write("""<style>.big-font {font-size:50px !important;}</style>""", unsafe_allow_html=True)
29
 
30
  # 상단 μ»¨ν…Œμ΄λ„ˆ
31
  with col2:
32
  st.header("μ‘°μž‘ νŒ¨λ„")
33
  user_input = st.text_input("λͺ¨λ₯΄λŠ” λ¬Έμž₯μ΄λ‚˜ 단어λ₯Ό μž…λ ₯ν•˜μ„Έμš”:", "")
 
34
 
35
  # λ²„νŠΌ row
36
- cols = st.columns(4)
37
  with cols[0]:
38
  btn_keyword = st.button("ν‚€μ›Œλ“œ μ°ΎκΈ°")
39
  with cols[1]:
@@ -42,6 +43,24 @@ def main():
42
  btn_simple = st.button("μ‰¬μš΄ ν‘œν˜„")
43
  with cols[3]:
44
  btn_rewrite = st.button("λ‹€μ‹œ μ“°κΈ°")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
45
 
46
  # ν•˜λ‹¨ μ»¨ν…Œμ΄λ„ˆ
47
  with st.container():
@@ -160,5 +179,28 @@ def main():
160
 
161
  st.write(f"λ‹€μ‹œ μ“°κΈ°: {explanation}")
162
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
163
  if __name__ == "__main__":
164
- main()
 
25
  반면 의무 νˆ¬ν‘œμ œμ— λ°˜λŒ€ν•˜λŠ” 츑은 ν˜„μž¬ μš°λ¦¬λ‚˜λΌμ˜ νˆ¬ν‘œμœ¨μ΄ μ •μΉ˜ μ§€λ„μžλ“€μ˜ λŒ€ν‘œμ„±μ„ 훼손할 만큼 μ‹¬κ°ν•œ 상황은 μ•„λ‹ˆλΌκ³  μ£Όμž₯ν•œλ‹€. 또 νˆ¬ν‘œμœ¨μ„ λ†’μ΄λŠ” 것보닀 ꡭ민의 μ‹ λ’°λ₯Ό νšŒλ³΅ν•˜λŠ” 것이 더 μ€‘μš”ν•˜κ³ , μ‹œλ―Ό κ΅μœ‘μ΄λ‚˜ λͺ¨μ˜ νˆ¬ν‘œ ꡐ윑 ν”„λ‘œκ·Έλž¨μœΌλ‘œλ„ νˆ¬ν‘œμœ¨ μƒμŠΉμ„ κΈ°λŒ€ν•  수 μžˆλ‹€λ©° 의무 νˆ¬ν‘œμ œμ˜ λ„μž…λ§Œμ΄ νˆ¬ν‘œμœ¨μ΄λ‚˜ μ •μΉ˜μ  관심을 λ†’μ΄λŠ” ν•΄κ²° λ°©μ•ˆμ€ μ•„λ‹ˆλΌκ³  μ΄μ•ΌκΈ°ν•œλ‹€. 그리고 의무 νˆ¬ν‘œμ œλ₯Ό λ„μž…ν•˜λ©΄, μ„ μΆœλœ μ •μΉ˜μΈλ“€μ΄ 높은 νˆ¬ν‘œμœ¨μ„ ν•‘κ³„λ‘œ μ•ˆν•˜λ¬΄μΈμ˜ νƒœλ„λ₯Ό κ°–λŠ” λΆ€μž‘μš©μ΄ 생긴닀든가 ν›„λ³΄μžλ₯Ό 잘 λͺ¨λ₯΄λŠ” μƒνƒœμ—μ„œ νˆ¬ν‘œν•˜λŠ” 일이 λ°œμƒν•˜μ—¬ ꡭ민의 뜻이 였히렀 μ™œκ³‘λ  수 μžˆλ‹€λ©° 우렀의 λͺ©μ†Œλ¦¬λ₯Ό λ‚΄κ³  μžˆλ‹€.
26
  """
27
  text_placeholder.write(user_text)
28
+ st.write("""<style>.stTextInput input {height: 100px;}</style>""", unsafe_allow_html=True)
29
 
30
  # 상단 μ»¨ν…Œμ΄λ„ˆ
31
  with col2:
32
  st.header("μ‘°μž‘ νŒ¨λ„")
33
  user_input = st.text_input("λͺ¨λ₯΄λŠ” λ¬Έμž₯μ΄λ‚˜ 단어λ₯Ό μž…λ ₯ν•˜μ„Έμš”:", "")
34
+ st.write(user_input)
35
 
36
  # λ²„νŠΌ row
37
+ cols = st.columns(5)
38
  with cols[0]:
39
  btn_keyword = st.button("ν‚€μ›Œλ“œ μ°ΎκΈ°")
40
  with cols[1]:
 
43
  btn_simple = st.button("μ‰¬μš΄ ν‘œν˜„")
44
  with cols[3]:
45
  btn_rewrite = st.button("λ‹€μ‹œ μ“°κΈ°")
46
+ with cols[4]: # μ±„μ ν•˜κΈ°
47
+ btn_score = st.button("μ±„μ ν•˜κΈ°")
48
+
49
+
50
+ #μš”μ•½ κ²°κ³Ό
51
+ with st.container():
52
+ st.header("μš”μ•½ κ²°κ³Ό")
53
+ st.text_input("μš”μ•½κ²°κ³Όλ₯Ό μ œμΆœν•˜μ„Έμš”.")
54
+ # λ²„νŠΌ row
55
+ cols = st.columns(1)
56
+ with cols[0]:
57
+ btn_submit = st.button("μ œμΆœν•˜κΈ°")
58
+
59
+ #제좜 λ²„νŠΌ λˆ„λ₯΄λ©΄ google drive api둜 μš”μ•½ κ²°κ³Όλ₯Ό ꡬ글 λ“œλΌμ΄λΈŒμ— μ €μž₯
60
+ if btn_submit:
61
+ pass
62
+
63
+
64
 
65
  # ν•˜λ‹¨ μ»¨ν…Œμ΄λ„ˆ
66
  with st.container():
 
179
 
180
  st.write(f"λ‹€μ‹œ μ“°κΈ°: {explanation}")
181
 
182
+ #λ£¨λΈŒλ¦­μ— μ˜ν•œ 채점 κ²°κ³Ό 좜λ ₯
183
+ if btn_score:
184
+ #루브릭 κΈ°μ€€ μΆ”κ°€
185
+ lubric = """1. λ¬Έμž₯의 주제λ₯Ό νŒŒμ•…ν•˜κ³ , μ£Όμš” λ‚΄μš©μ„ νŒŒμ•…ν•  수 μžˆμ–΄μ•Ό ν•œλ‹€."""
186
+
187
+ explanation_task = f"Score the following text based on the following rubric: {lubric}"
188
+
189
+ messages = [
190
+ {"role": "system", "content": "You are a helpful assistant. use only korean"},
191
+ {"role": "user", "content": explanation_task}
192
+ ]
193
+
194
+ response = openai.ChatCompletion.create(
195
+ model="gpt-3.5-turbo-16k",
196
+ messages=messages,
197
+ temperature=0.1,
198
+ max_tokens=2500
199
+ )
200
+
201
+ explanation = response['choices'][0]['message']['content']
202
+
203
+ st.write(f"채점 ν•˜κΈ°: {explanation}")
204
+
205
  if __name__ == "__main__":
206
+ main()