JUNGU commited on
Commit
c2c17ab
ยท
1 Parent(s): 24b820e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +28 -4
app.py CHANGED
@@ -15,7 +15,7 @@ openai.api_key = os.getenv("OPENAI_API_KEY") # ์‹ค์ œ ์ฝ”๋“œ์—์„œ ์ฃผ์„ ํ•ด
15
  def main():
16
  st.title("ํ•œ๊ตญ์–ด ํ•™์Šต์ž๋ฅผ ์œ„ํ•œ HCI tools")
17
 
18
- col1, col2 = st.columns([60, 40], gap="large")
19
 
20
  with col1:
21
  st.header("์ง€๋ฌธ")
@@ -30,7 +30,7 @@ def main():
30
  with col2:
31
  user_input = st.text_input("๋ชจ๋ฅด๋Š” ๋ฌธ์žฅ์ด๋‚˜ ๋‹จ์–ด๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”:", "")
32
 
33
- cols = st.columns(3)
34
  with cols[0]:
35
  if st.button("ํ‚ค์›Œ๋“œ ์ฐพ๊ธฐ"):
36
  task_description ="""You are a useful helper that generates annotated text for Python's st-annotated-text library. Your task is to identify the topic of the passage and highlight the key words needed to convey the meaning. You should be able to identify the main points. Also, please mark keywords based on the different paragraphs and headings provided in the text. The output should be formatted in the following way:
@@ -82,7 +82,7 @@ def main():
82
  model="gpt-3.5-turbo-16k",
83
  messages=messages,
84
  temperature=0.1,
85
- max_tokens=150
86
  )
87
 
88
  explanation = response['choices'][0]['message']['content']
@@ -108,7 +108,30 @@ def main():
108
  model="gpt-3.5-turbo-16k",
109
  messages=messages,
110
  temperature=0.1,
111
- max_tokens=150
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
112
  )
113
 
114
  explanation = response['choices'][0]['message']['content']
@@ -118,5 +141,6 @@ def main():
118
  st.write(explanation)
119
  pass
120
 
 
121
  if __name__ == "__main__":
122
  main()
 
15
  def main():
16
  st.title("ํ•œ๊ตญ์–ด ํ•™์Šต์ž๋ฅผ ์œ„ํ•œ HCI tools")
17
 
18
+ col1, col2 = st.columns([70, 30])
19
 
20
  with col1:
21
  st.header("์ง€๋ฌธ")
 
30
  with col2:
31
  user_input = st.text_input("๋ชจ๋ฅด๋Š” ๋ฌธ์žฅ์ด๋‚˜ ๋‹จ์–ด๋ฅผ ์ž…๋ ฅํ•˜์„ธ์š”:", "")
32
 
33
+ cols = st.columns(4)
34
  with cols[0]:
35
  if st.button("ํ‚ค์›Œ๋“œ ์ฐพ๊ธฐ"):
36
  task_description ="""You are a useful helper that generates annotated text for Python's st-annotated-text library. Your task is to identify the topic of the passage and highlight the key words needed to convey the meaning. You should be able to identify the main points. Also, please mark keywords based on the different paragraphs and headings provided in the text. The output should be formatted in the following way:
 
82
  model="gpt-3.5-turbo-16k",
83
  messages=messages,
84
  temperature=0.1,
85
+ max_tokens=200
86
  )
87
 
88
  explanation = response['choices'][0]['message']['content']
 
108
  model="gpt-3.5-turbo-16k",
109
  messages=messages,
110
  temperature=0.1,
111
+ max_tokens=500
112
+ )
113
+
114
+ explanation = response['choices'][0]['message']['content']
115
+
116
+ # ์‰ฌ์šด ํ‘œํ˜„์œผ๋กœ ๊ฒฐ๊ณผ ์ถœ๋ ฅ
117
+ st.text("์„ค๋ช…:")
118
+ st.write(explanation)
119
+ pass
120
+ #๋ฒ„ํŠผ์„ ๋ˆ„๋ฅด๋ฉด ์ž…๋ ฅ์ค‘์ธ ๊ธ€์„ ๋‹ค๋“ฌ์–ด์„œ ๋‹ค์‹œ ์จ์คŒ
121
+ with cols[3]:
122
+ if st.button("๋‹ค์‹œ ์“ฐ๊ธฐ"):
123
+ explanation_task = f"Rewrite the contents of '{user_input}' so that it will pass the writing test."
124
+
125
+ messages = [
126
+ {"role": "system", "content": "You are a helpful assistant. use only korean"},
127
+ {"role": "user", "content": explanation_task}
128
+ ]
129
+
130
+ response = openai.ChatCompletion.create(
131
+ model="gpt-3.5-turbo-16k",
132
+ messages=messages,
133
+ temperature=0.1,
134
+ max_tokens=1000
135
  )
136
 
137
  explanation = response['choices'][0]['message']['content']
 
141
  st.write(explanation)
142
  pass
143
 
144
+
145
  if __name__ == "__main__":
146
  main()