Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -27,18 +27,6 @@ dataset2 = fs.get_feature_group(name="daily_document_info").read()
|
|
27 |
df2 = dataset2
|
28 |
topics = df['topic'].unique()
|
29 |
|
30 |
-
conversation_history = []
|
31 |
-
|
32 |
-
def add_user_input(user_input):
|
33 |
-
conversation_history.append({"role": "user", "content": user_input})
|
34 |
-
|
35 |
-
|
36 |
-
# Example usage:
|
37 |
-
add_user_input("[season, gordon, doncic, points, nba, nuggets, rebounds, kuminga, game, raptors]")
|
38 |
-
add_user_input("Give me a precise word for each item in the list.")
|
39 |
-
add_user_input("NBA was ok.")
|
40 |
-
add_user_input("With no brackets.")
|
41 |
-
|
42 |
def gpt_predict(inputs, request:gr.Request=gr.State([]), top_p = 1, temperature = 1, chat_counter = 0,history =[]):
|
43 |
payload = {
|
44 |
"model": MODEL,
|
@@ -120,7 +108,7 @@ def gpt_predict(inputs, request:gr.Request=gr.State([]), top_p = 1, temperature
|
|
120 |
return partial_words
|
121 |
|
122 |
readable_topics_dic = dict()
|
123 |
-
input = "
|
124 |
|
125 |
for t in topics.tolist():
|
126 |
if t != -1:
|
@@ -129,8 +117,7 @@ for t in topics.tolist():
|
|
129 |
input += ", [" + ", ".join(keywords) + "]"
|
130 |
break
|
131 |
|
132 |
-
input += "
|
133 |
-
print(input)
|
134 |
new_topics = "".join(gpt_predict(input))
|
135 |
print("ok:", new_topics)
|
136 |
nt = new_topics.split("//")
|
|
|
27 |
df2 = dataset2
|
28 |
topics = df['topic'].unique()
|
29 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
def gpt_predict(inputs, request:gr.Request=gr.State([]), top_p = 1, temperature = 1, chat_counter = 0,history =[]):
|
31 |
payload = {
|
32 |
"model": MODEL,
|
|
|
108 |
return partial_words
|
109 |
|
110 |
readable_topics_dic = dict()
|
111 |
+
input = "I have lists of multiple words : "
|
112 |
|
113 |
for t in topics.tolist():
|
114 |
if t != -1:
|
|
|
117 |
input += ", [" + ", ".join(keywords) + "]"
|
118 |
break
|
119 |
|
120 |
+
input += " I want you to give me only one precise word that best describes the theme of this list. If I give you multiple lists, I want you to give me one word for each of those lists, and separate them by // (your answer should contain only one word for each)
|
|
|
121 |
new_topics = "".join(gpt_predict(input))
|
122 |
print("ok:", new_topics)
|
123 |
nt = new_topics.split("//")
|