Update app.py
Browse files
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([
|
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(
|
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=
|
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=
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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()
|