tejastake commited on
Commit
eb9be95
·
verified ·
1 Parent(s): fe2458a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -9
app.py CHANGED
@@ -74,15 +74,15 @@ class EmbeddingModels:
74
  df_chunk = self.preprocessing_patent_data(df_chunk)
75
  txt_sp = self.sparse_model.encode_documents(df_chunk)
76
 
77
- # tensor = torch.tensor(txt_sp['values'])
78
- # normalized_tensor = F.normalize(tensor, p=2.0, dim=0, eps=1e-12)
79
- # values = normalized_tensor.tolist()
80
-
81
- # # Update the sparse_vector with normalized values
82
- # normalized_sparse_vector = {
83
- # 'indices': txt_sp['indices'],
84
- # 'values': values
85
- # }
86
  return txt_sp
87
 
88
 
 
74
  df_chunk = self.preprocessing_patent_data(df_chunk)
75
  txt_sp = self.sparse_model.encode_documents(df_chunk)
76
 
77
+ tensor = torch.tensor(txt_sp['values'])
78
+ normalized_tensor = F.normalize(tensor, p=2.0, dim=0, eps=1e-12)
79
+ values = normalized_tensor.tolist()
80
+
81
+ # Update the sparse_vector with normalized values
82
+ normalized_sparse_vector = {
83
+ 'indices': txt_sp['indices'],
84
+ 'values': values
85
+ }
86
  return txt_sp
87
 
88