manan commited on
Commit
e69ca69
1 Parent(s): 6bc7aa1

Update model.py

Browse files
Files changed (1) hide show
  1. model.py +7 -6
model.py CHANGED
@@ -234,6 +234,12 @@ def get_predictions(feature_text, pn_history):
234
  pn_history = pn_history.lower()
235
 
236
  location_preds, pred_string = predict_location_preds(tokenizer, model, [feature_text], [pn_history])
 
 
 
 
 
 
237
  return pred_string
238
 
239
  tokenizer = AutoTokenizer.from_pretrained(config['tokenizer_path'])
@@ -246,9 +252,4 @@ model.load_state_dict(
246
  map_location=torch.device(config['device'])
247
  )
248
  )
249
- model.eval()
250
-
251
- # input_text = create_sample_test()
252
- # feature_text = input_text.feature_text[0]
253
- # pn_history = input_text.pn_history[0]
254
- # get_predictions(feature_text, pn_history)
 
234
  pn_history = pn_history.lower()
235
 
236
  location_preds, pred_string = predict_location_preds(tokenizer, model, [feature_text], [pn_history])
237
+
238
+ if pred_string == "":
239
+ pred_string = 'Feature not present!'
240
+ else:
241
+ pred_string = 'Feature is present!' + '\nText Span - ' + pred_string
242
+
243
  return pred_string
244
 
245
  tokenizer = AutoTokenizer.from_pretrained(config['tokenizer_path'])
 
252
  map_location=torch.device(config['device'])
253
  )
254
  )
255
+ model.eval()