JUNGU commited on
Commit
563562a
ยท
1 Parent(s): d61fdd4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +38 -38
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
- # 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,7 +96,7 @@ def main():
96
  response = openai.ChatCompletion.create(
97
  model="gpt-3.5-turbo-16k",
98
  messages=messages,
99
- temperature=0,
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,