Update app.py
Browse files
app.py
CHANGED
@@ -47,6 +47,24 @@ def main():
|
|
47 |
# ". "
|
48 |
# )"""
|
49 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
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:
|
51 |
annotated_text(
|
52 |
"This ",
|
@@ -63,12 +81,13 @@ def main():
|
|
63 |
". "
|
64 |
)"""
|
65 |
|
66 |
-
user_prompt = f"
|
|
|
67 |
|
68 |
messages = [{"role": "system", "content": task_description}, {"role": "user", "content": user_prompt}]
|
69 |
|
70 |
response = openai.ChatCompletion.create(
|
71 |
-
model="gpt-
|
72 |
messages=messages,
|
73 |
temperature=0.1,
|
74 |
max_tokens=1000
|
|
|
47 |
# ". "
|
48 |
# )"""
|
49 |
|
50 |
+
# 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:
|
51 |
+
# annotated_text(
|
52 |
+
# "This ",
|
53 |
+
# ("is", ""),
|
54 |
+
# " some ",
|
55 |
+
# ("annotated", ""),
|
56 |
+
# ("text", ""),
|
57 |
+
# " for those of ",
|
58 |
+
# ("you", ""),
|
59 |
+
# " who ",
|
60 |
+
# ("like", ""),
|
61 |
+
# " this sort of ",
|
62 |
+
# ("thing", ""),
|
63 |
+
# ". "
|
64 |
+
# )"""
|
65 |
+
|
66 |
+
# user_prompt = f"Now, please annotate this text: {user_text}"
|
67 |
+
|
68 |
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:
|
69 |
annotated_text(
|
70 |
"This ",
|
|
|
81 |
". "
|
82 |
)"""
|
83 |
|
84 |
+
user_prompt = f"Based on the task description, please annotate the following text by highlighting the key terms central to its topic or theme: {user_text}"
|
85 |
+
|
86 |
|
87 |
messages = [{"role": "system", "content": task_description}, {"role": "user", "content": user_prompt}]
|
88 |
|
89 |
response = openai.ChatCompletion.create(
|
90 |
+
model="gpt-3.5-turbo-16k",
|
91 |
messages=messages,
|
92 |
temperature=0.1,
|
93 |
max_tokens=1000
|