cotxetj commited on
Commit
868d663
1 Parent(s): 03820d9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -12
app.py CHANGED
@@ -17,18 +17,6 @@ dataset2 = fs.get_feature_group(name="daily_document_info").read()
17
  df2 = dataset2
18
  topics = df['topic'].unique()
19
 
20
- readable_topics_dic = dict()
21
- readable_topics = []
22
- for t in topics.tolist():
23
- selected_data = df[df['topic'] == t]
24
- keywords = selected_data['keywords'][selected_data.index[0]]
25
- input = "With an answer of only few words (less than 5) give me a word or expression that charaterise the best this set of words as if it was the description of a theme: " + str(keywords)
26
- new_topic = gpt_predict(input)
27
- readable_topics += new_topic
28
- readable_topics_dic[new_topic] = t
29
- break
30
- print(readable_topics)
31
-
32
  def gpt_predict(inputs, request:gr.Request=gr.State([]), top_p = 1, temperature = 1, chat_counter = 0,history =[]):
33
  payload = {
34
  "model": MODEL,
@@ -111,6 +99,20 @@ def gpt_predict(inputs, request:gr.Request=gr.State([]), top_p = 1, temperature
111
  print (f'error found: {e}')
112
  return partial_words
113
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
114
  def display_topics(topic):
115
  topic = readable_topics_dic[topic]
116
  # Filter DataFrame based on the selected topic
 
17
  df2 = dataset2
18
  topics = df['topic'].unique()
19
 
 
 
 
 
 
 
 
 
 
 
 
 
20
  def gpt_predict(inputs, request:gr.Request=gr.State([]), top_p = 1, temperature = 1, chat_counter = 0,history =[]):
21
  payload = {
22
  "model": MODEL,
 
99
  print (f'error found: {e}')
100
  return partial_words
101
 
102
+ readable_topics_dic = dict()
103
+ readable_topics = []
104
+ for t in topics.tolist():
105
+ selected_data = df[df['topic'] == t]
106
+ keywords = selected_data['keywords'][selected_data.index[0]]
107
+ input = "With an answer of only few words (less than 5) give me a word or expression that charaterise the best this set of words as if it was the description of a theme: " + str(keywords)
108
+ new_topic = gpt_predict(input)
109
+ readable_topics += new_topic
110
+ readable_topics_dic[new_topic] = t
111
+ break
112
+ print(readable_topics)
113
+
114
+
115
+
116
  def display_topics(topic):
117
  topic = readable_topics_dic[topic]
118
  # Filter DataFrame based on the selected topic