Asutosh2003 commited on
Commit
bd209d0
1 Parent(s): f1866af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -61,7 +61,7 @@ def rmTrash(raw_string, remuser, remstop, remurls):
61
 
62
  def return_vec(text):
63
  text = rmTrash(text,True,True,True)
64
- encodings = tokenizer.encode_plus(
65
  text,
66
  None,
67
  add_special_tokens=True,
@@ -71,15 +71,15 @@ def return_vec(text):
71
  truncation=True,
72
  return_attention_mask=True,
73
  return_tensors='pt'
74
- )
75
- model.eval()
76
- with torch.no_grad():
77
  input_ids = encodings['input_ids'].to(device, dtype=torch.long)
78
  attention_mask = encodings['attention_mask'].to(device, dtype=torch.long)
79
  token_type_ids = encodings['token_type_ids'].to(device, dtype=torch.long)
80
  output = model(input_ids, attention_mask, token_type_ids)
81
  final_output = torch.sigmoid(output).cpu().detach().numpy().tolist()
82
- return list(final_output[0])
83
 
84
 
85
  def filter_threshold_lst(vector, threshold_list):
 
61
 
62
  def return_vec(text):
63
  text = rmTrash(text,True,True,True)
64
+ encodings = tokenizer.encode_plus(
65
  text,
66
  None,
67
  add_special_tokens=True,
 
71
  truncation=True,
72
  return_attention_mask=True,
73
  return_tensors='pt'
74
+ )
75
+ model.eval()
76
+ with torch.no_grad():
77
  input_ids = encodings['input_ids'].to(device, dtype=torch.long)
78
  attention_mask = encodings['attention_mask'].to(device, dtype=torch.long)
79
  token_type_ids = encodings['token_type_ids'].to(device, dtype=torch.long)
80
  output = model(input_ids, attention_mask, token_type_ids)
81
  final_output = torch.sigmoid(output).cpu().detach().numpy().tolist()
82
+ return list(final_output[0])
83
 
84
 
85
  def filter_threshold_lst(vector, threshold_list):