Update app.py
Browse files
app.py
CHANGED
@@ -14,28 +14,22 @@ def main():
|
|
14 |
|
15 |
if st.button("Find Keywords"):
|
16 |
|
17 |
-
#
|
18 |
-
|
19 |
-
|
20 |
-
|
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:
|
@@ -56,21 +50,21 @@ def main():
|
|
56 |
|
57 |
#์ถ๋ ฅ ํ์ธํ๋ ์ฌ๋ฌ๋ถ์ Python์ st-annotated-text ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ํด ์ฃผ์์ด ๋ฌ๋ฆฐ ํ
์คํธ๋ฅผ ์์ฑํ๋ ์ ์ฉํ ๋์ฐ๋ฏธ์
๋๋ค. ์ง๋ฌธ์ ์ฃผ์ ๋ฅผ ํ์
ํ๊ณ ์๋ฏธ ์ ๋ฌ์ ํ์ํ ํต์ฌ์ด๋ฅผ ๊ฐ์กฐ ํ์ํ๋ ๊ฒ์ด ์ฌ๋ฌ๋ถ์ ์๋ฌด์
๋๋ค. ์ถ๋ ฅ๋ฌผ์ ํ์์ ๋ค์๊ณผ ๊ฐ์ ๋ฐฉ์์ผ๋ก ์ง์ ํด์ผ ํฉ๋๋ค.
|
58 |
|
59 |
-
task_description = """You are a useful helper that generates annotated text for Python's st-annotated-text library. Your job is to identify the topic of the fingerprint and highlight the key words needed to convey meaning. The output should be formatted in the following way:
|
60 |
-
annotated_text(
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
|
72 |
-
|
73 |
-
)"""
|
74 |
|
75 |
# user_prompt = f"Now, please annotate this text: {user_text}"
|
76 |
|
@@ -97,9 +91,9 @@ def main():
|
|
97 |
messages = [{"role": "system", "content": task_description}, {"role": "user", "content": user_prompt}]
|
98 |
|
99 |
response = openai.ChatCompletion.create(
|
100 |
-
model="gpt-
|
101 |
messages=messages,
|
102 |
-
temperature=1,
|
103 |
max_tokens=2500,
|
104 |
top_p=1,
|
105 |
frequency_penalty=0,
|
|
|
14 |
|
15 |
if st.button("Find Keywords"):
|
16 |
|
17 |
+
# few-shot learning์ ์ด์ฉํ task_description
|
18 |
+
task_description = """You are a useful helper that generates annotated text for Python's st-annotated-text library. Your job is to identify the topic of the fingerprint and highlight the key words needed to convey meaning. The output should be formatted in the following way:
|
19 |
+
annotated_text(
|
20 |
+
"This ",
|
21 |
+
("is", ""),
|
22 |
+
" some ",
|
23 |
+
("annotated", ""),
|
24 |
+
("text", ""),
|
25 |
+
" for those of ",
|
26 |
+
("you", ""),
|
27 |
+
" who ",
|
28 |
+
("like", ""),
|
29 |
+
" this sort of ",
|
30 |
+
("thing", ""),
|
31 |
+
". "
|
32 |
+
)"""
|
|
|
|
|
|
|
|
|
|
|
|
|
33 |
|
34 |
|
35 |
# 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:
|
|
|
50 |
|
51 |
#์ถ๋ ฅ ํ์ธํ๋ ์ฌ๋ฌ๋ถ์ Python์ st-annotated-text ๋ผ์ด๋ธ๋ฌ๋ฆฌ๋ฅผ ์ํด ์ฃผ์์ด ๋ฌ๋ฆฐ ํ
์คํธ๋ฅผ ์์ฑํ๋ ์ ์ฉํ ๋์ฐ๋ฏธ์
๋๋ค. ์ง๋ฌธ์ ์ฃผ์ ๋ฅผ ํ์
ํ๊ณ ์๋ฏธ ์ ๋ฌ์ ํ์ํ ํต์ฌ์ด๋ฅผ ๊ฐ์กฐ ํ์ํ๋ ๊ฒ์ด ์ฌ๋ฌ๋ถ์ ์๋ฌด์
๋๋ค. ์ถ๋ ฅ๋ฌผ์ ํ์์ ๋ค์๊ณผ ๊ฐ์ ๋ฐฉ์์ผ๋ก ์ง์ ํด์ผ ํฉ๋๋ค.
|
52 |
|
53 |
+
# task_description = """You are a useful helper that generates annotated text for Python's st-annotated-text library. Your job is to identify the topic of the fingerprint and highlight the key words needed to convey meaning. The output should be formatted in the following way:
|
54 |
+
# annotated_text(
|
55 |
+
# "This ",
|
56 |
+
# ("is", ""),
|
57 |
+
# " some ",
|
58 |
+
# ("annotated", ""),
|
59 |
+
# ("text", ""),
|
60 |
+
# " for those of ",
|
61 |
+
# ("you", ""),
|
62 |
+
# " who ",
|
63 |
+
# ("like", ""),
|
64 |
+
# " this sort of ",
|
65 |
+
# ("thing", ""),
|
66 |
+
# ". "
|
67 |
+
# )"""
|
68 |
|
69 |
# user_prompt = f"Now, please annotate this text: {user_text}"
|
70 |
|
|
|
91 |
messages = [{"role": "system", "content": task_description}, {"role": "user", "content": user_prompt}]
|
92 |
|
93 |
response = openai.ChatCompletion.create(
|
94 |
+
model="gpt-3.5-turbo-16k",
|
95 |
messages=messages,
|
96 |
+
temperature=1.3,
|
97 |
max_tokens=2500,
|
98 |
top_p=1,
|
99 |
frequency_penalty=0,
|