JUNGU commited on
Commit
3f3b508
โ€ข
1 Parent(s): d432e9d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +33 -39
app.py CHANGED
@@ -14,28 +14,22 @@ 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:
@@ -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
- "This ",
62
- ("is", ""),
63
- " some ",
64
- ("annotated", ""),
65
- ("text", ""),
66
- " for those of ",
67
- ("you", ""),
68
- " who ",
69
- ("like", ""),
70
- " this sort of ",
71
- ("thing", ""),
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-4",
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,