DanichOne commited on
Commit
3327bb3
1 Parent(s): b12d155

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -7
app.py CHANGED
@@ -129,12 +129,11 @@ def update_embeddings():
129
  if len(df) != len(df_emb):
130
  id_to_add = [x + len(df_emb) for x in range(len(df) - len(df_emb))]
131
  for i in id_to_add:
132
- print(model.encode(markdn_2_str(df.iloc[i])))
133
- print(len(model.encode(markdn_2_str(df.iloc[i]))))
134
  df_emb.loc[i] = model.encode(markdn_2_str(df.iloc[i]))
135
  else:
136
- event.clear()
137
  df_emb.to_csv('df_emb.csv', index=False)
 
138
 
139
 
140
 
@@ -179,9 +178,6 @@ if __name__ == '__main__':
179
  # df.to_excel('df.xlsx', index=False)
180
  # df_emb.to_csv('df_emb.csv', index=False)
181
 
182
-
183
-
184
-
185
  POST_ID = len(df)
186
 
187
  update_thread = threading.Thread(target=run_periodically) # background proposals update
@@ -203,4 +199,4 @@ if __name__ == '__main__':
203
  otpt = gr.Markdown("")
204
  btn.click(fn=compare_proposals, inputs=[inpt, slider], outputs=otpt)
205
 
206
- demo.launch(show_error=True)
 
129
  if len(df) != len(df_emb):
130
  id_to_add = [x + len(df_emb) for x in range(len(df) - len(df_emb))]
131
  for i in id_to_add:
 
 
132
  df_emb.loc[i] = model.encode(markdn_2_str(df.iloc[i]))
133
  else:
134
+ print('embeddings updated at {t}'.format(t=time.strftime("%H:%M:%S", time.localtime())))
135
  df_emb.to_csv('df_emb.csv', index=False)
136
+ event.clear()
137
 
138
 
139
 
 
178
  # df.to_excel('df.xlsx', index=False)
179
  # df_emb.to_csv('df_emb.csv', index=False)
180
 
 
 
 
181
  POST_ID = len(df)
182
 
183
  update_thread = threading.Thread(target=run_periodically) # background proposals update
 
199
  otpt = gr.Markdown("")
200
  btn.click(fn=compare_proposals, inputs=[inpt, slider], outputs=otpt)
201
 
202
+ demo.launch()