Update app.py
Browse files
app.py
CHANGED
@@ -14,28 +14,28 @@ def main():
|
|
14 |
|
15 |
if st.button("Find Keywords"):
|
16 |
|
17 |
-
# few-shot learning์ ์ด์ฉํ task_description
|
18 |
-
task_description = """์ฃผ์ด์ง ์ง๋ฌธ์ ์ค์ํ ํค์๋๋ฅผ {few-shot} ํํ๋ก ๋งํฌ์
ํ์ฌ ์ถ๋ ฅํ๋ Python ์ฝ๋๋ฅผ ์์ฑํ์ธ์.
|
19 |
-
```
|
20 |
-
annotated_text(
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
|
25 |
-
|
26 |
-
|
27 |
-
|
28 |
-
|
29 |
-
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
34 |
-
|
35 |
-
|
36 |
-
)
|
37 |
-
```
|
38 |
-
"""
|
39 |
|
40 |
|
41 |
# task_description = """You are a helpful assistant that generates annotated text for the st-annotated-text library in Python. Highlight the key terms that are most important in the context of the sentence, especially focusing on the main subject involved. Your output should be formatted in the following way for text:
|
@@ -72,21 +72,21 @@ def main():
|
|
72 |
|
73 |
# user_prompt = f"Now, please annotate this text: {user_text}"
|
74 |
|
75 |
-
|
76 |
-
|
77 |
-
|
78 |
-
|
79 |
-
|
80 |
-
|
81 |
-
|
82 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
|
91 |
user_prompt = f"Based on the task description, please annotate the following text by highlighting the key terms central to its topic : {user_text}"
|
92 |
|
@@ -96,7 +96,7 @@ def main():
|
|
96 |
response = openai.ChatCompletion.create(
|
97 |
model="gpt-3.5-turbo-16k",
|
98 |
messages=messages,
|
99 |
-
temperature=
|
100 |
max_tokens=2500,
|
101 |
top_p=1,
|
102 |
frequency_penalty=0,
|
|
|
14 |
|
15 |
if st.button("Find Keywords"):
|
16 |
|
17 |
+
# # few-shot learning์ ์ด์ฉํ task_description
|
18 |
+
# task_description = """์ฃผ์ด์ง ์ง๋ฌธ์ ์ค์ํ ํค์๋๋ฅผ {few-shot} ํํ๋ก ๋งํฌ์
ํ์ฌ ์ถ๋ ฅํ๋ Python ์ฝ๋๋ฅผ ์์ฑํ์ธ์.
|
19 |
+
# ```
|
20 |
+
# annotated_text(
|
21 |
+
# ("๋ฏผ์ฃผ์ฃผ์ ์ฌํ", ""),
|
22 |
+
# " ๋ ๊ตญ๋ฏผ์ด ์ ์น์ ์ฐธ์ฌํ ๊ถ๋ฆฌ๋ฅผ ๋ณด์ฅํ๋ค. ๊ทธ๋ฌํ ๊ถ๋ฆฌ๋ฅผ",
|
23 |
+
# ("์ฐธ์ ๊ถ", ""),
|
24 |
+
# "์ด๋ผ ํ๋๋ฐ, ์ด๋ ๊ธฐ๋ณธ์ ์ผ๋ก "
|
25 |
+
# ("์ ๊ฑฐ", ""),
|
26 |
+
# "๋ก ์คํ๋๋ค. ",
|
27 |
+
# ("์ ๊ฑฐ", ""),
|
28 |
+
# " ๋ ์ฌํ ์ง๋จ์ ๋ํ์๋ ๊ณต์ง์๋ค์ ์ ์ถํ์ฌ ๊ทธ๋ค์๊ฒ ",
|
29 |
+
# ("๋ํ์ฑ", ""),
|
30 |
+
# " ์ ๋ถ์ฌํ๋ ํ์์ด๋ค. ๊ทธ๋ฌ๋ฏ๋ก ",
|
31 |
+
# ("๋์ ํฌํ์จ", ""),
|
32 |
+
# " ๋ฏผ์ฃผ์ฃผ์์ ",
|
33 |
+
# ("์ ๋น์ฑ", ""),
|
34 |
+
# " ํ๋ณด์ ๊น์ ๊ด๋ จ์ด ์๋ค ",
|
35 |
+
# ". "
|
36 |
+
# )
|
37 |
+
# ```
|
38 |
+
# """
|
39 |
|
40 |
|
41 |
# task_description = """You are a helpful assistant that generates annotated text for the st-annotated-text library in Python. Highlight the key terms that are most important in the context of the sentence, especially focusing on the main subject involved. Your output should be formatted in the following way for text:
|
|
|
72 |
|
73 |
# user_prompt = f"Now, please annotate this text: {user_text}"
|
74 |
|
75 |
+
task_description = """You are a helpful assistant that generates annotated text for the st-annotated-text library in Python. Your task is to highlight the key terms that are central to the overall topic or theme of the sentence. Your output should be formatted in the following way:
|
76 |
+
annotated_text(
|
77 |
+
"This ",
|
78 |
+
("is", ""),
|
79 |
+
" some ",
|
80 |
+
("annotated", ""),
|
81 |
+
("text", ""),
|
82 |
+
" for those of ",
|
83 |
+
("you", ""),
|
84 |
+
" who ",
|
85 |
+
("like", ""),
|
86 |
+
" this sort of ",
|
87 |
+
("thing", ""),
|
88 |
+
". "
|
89 |
+
)"""
|
90 |
|
91 |
user_prompt = f"Based on the task description, please annotate the following text by highlighting the key terms central to its topic : {user_text}"
|
92 |
|
|
|
96 |
response = openai.ChatCompletion.create(
|
97 |
model="gpt-3.5-turbo-16k",
|
98 |
messages=messages,
|
99 |
+
temperature=1,
|
100 |
max_tokens=2500,
|
101 |
top_p=1,
|
102 |
frequency_penalty=0,
|