m7n commited on
Commit
9893197
·
verified ·
1 Parent(s): 9ac0353

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -38
app.py CHANGED
@@ -150,43 +150,6 @@ def get_field(x):
150
  return np.nan
151
 
152
 
153
- #def query_records(search_term):
154
-
155
-
156
- # # Fetch records based on the search term in the abstract!
157
- # query = Works().search([search_term])
158
- # query_length = Works().search([search_term]).count()
159
-
160
- # records = []
161
- # #total_pages = (query_length + 199) // 200 # Calculate total number of pages
162
- # progress=gr.Progress()
163
-
164
- # for i, record in progress.tqdm(enumerate(chain(*query.paginate(per_page=200)))):
165
- # records.append(record)
166
-
167
- # # Calculate progress from 0 to 0.1
168
- # #achieved_progress = min(0.1, (i + 1) / query_length * 0.1)
169
-
170
- # # Update progress bar
171
- # #progress(achieved_progress, desc="Getting queried data...")
172
-
173
-
174
-
175
- # records_df = pd.DataFrame(records)
176
- # records_df['abstract'] = [invert_abstract(t) for t in records_df['abstract_inverted_index']]
177
-
178
- # records_df['parsed_publication'] = [get_pub(x) for x in records_df['primary_location']]
179
-
180
-
181
- # records_df['parsed_publication'] = records_df['parsed_publication'].fillna(' ')
182
- # records_df['abstract'] = records_df['abstract'].fillna(' ')
183
- # records_df['title'] = records_df['title'].fillna(' ')
184
-
185
-
186
- # return records_df
187
-
188
-
189
- ################# Setting up the model for specter2 embeddings ###################
190
 
191
 
192
 
@@ -206,7 +169,7 @@ model = SentenceTransformer("m7n/discipline-tuned_specter_2_024")
206
  @spaces.GPU(duration=60)
207
  def create_embeddings(texts_to_embedd):
208
 
209
- embeddings = model.encode(texts_to_embedd,show_progress_bar=True,batch_size=32)
210
 
211
  return embeddings
212
 
 
150
  return np.nan
151
 
152
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
153
 
154
 
155
 
 
169
  @spaces.GPU(duration=60)
170
  def create_embeddings(texts_to_embedd):
171
 
172
+ embeddings = model.encode(texts_to_embedd,show_progress_bar=True,batch_size=192)
173
 
174
  return embeddings
175