Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -103,21 +103,23 @@ def gpt_predict(inputs, request:gr.Request=gr.State([]), top_p = 1, temperature
|
|
103 |
return partial_words
|
104 |
|
105 |
readable_topics_dic = dict()
|
106 |
-
|
107 |
-
input = "With an answer of only few words (less than 5) give me a word or expression that charaterise the best each one of those set of words as if it was the description of a theme: "
|
108 |
|
109 |
for t in topics.tolist():
|
110 |
if t != -1:
|
111 |
selected_data = df[df['topic'] == t]
|
112 |
keywords = selected_data['keywords'][selected_data.index[0]]
|
113 |
-
print("ky ",keywords)
|
114 |
input += ", [" + ", ".join(keywords) + "]"
|
115 |
|
116 |
input += " (separate each expression by //)"
|
117 |
print(input)
|
118 |
new_topics = "".join(gpt_predict(input))
|
119 |
-
|
120 |
-
|
|
|
|
|
|
|
|
|
121 |
|
122 |
|
123 |
|
|
|
103 |
return partial_words
|
104 |
|
105 |
readable_topics_dic = dict()
|
106 |
+
input = "With an answer of only few words (less than 5) give me an expression that charaterises the best each one of those set of words as if it was the description of a theme: "
|
|
|
107 |
|
108 |
for t in topics.tolist():
|
109 |
if t != -1:
|
110 |
selected_data = df[df['topic'] == t]
|
111 |
keywords = selected_data['keywords'][selected_data.index[0]]
|
|
|
112 |
input += ", [" + ", ".join(keywords) + "]"
|
113 |
|
114 |
input += " (separate each expression by //)"
|
115 |
print(input)
|
116 |
new_topics = "".join(gpt_predict(input))
|
117 |
+
nt = new_topics.split("//")
|
118 |
+
i = 0
|
119 |
+
for t in topics.tolist():
|
120 |
+
if t != -1:
|
121 |
+
readable_topics_dic[nt[i]] = t
|
122 |
+
print("nt ", readable_topics_dic)
|
123 |
|
124 |
|
125 |
|