aliasgerovs commited on
Commit
617df1d
·
1 Parent(s): 6aa7315

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -175,7 +175,7 @@ AI DETECTION SECTION
175
  """
176
  device = "cuda" if torch.cuda.is_available() else "cpu"
177
 
178
- text_bc_model_path = "polygraf-ai/ai-text-bc-bert-2-7m"
179
  text_bc_tokenizer = AutoTokenizer.from_pretrained(text_bc_model_path)
180
  text_bc_model = AutoModelForSequenceClassification.from_pretrained(text_bc_model_path).to(device)
181
 
@@ -192,8 +192,9 @@ def update_character_count(text):
192
 
193
  def predict_bc(model, tokenizer, text):
194
  tokens = tokenizer(
195
- text, padding=True, truncation=True, return_tensors="pt"
196
  ).to(device)["input_ids"]
 
197
  output = model(tokens)
198
  output_norm = softmax(output.logits.detach().cpu().numpy(), 1)[0]
199
  print("BC Score: ", output_norm)
 
175
  """
176
  device = "cuda" if torch.cuda.is_available() else "cpu"
177
 
178
+ text_bc_model_path = "polygraf-ai/v3-bert-3-2m-trun-bc"
179
  text_bc_tokenizer = AutoTokenizer.from_pretrained(text_bc_model_path)
180
  text_bc_model = AutoModelForSequenceClassification.from_pretrained(text_bc_model_path).to(device)
181
 
 
192
 
193
  def predict_bc(model, tokenizer, text):
194
  tokens = tokenizer(
195
+ text, padding='max_length', truncation=True, max_length=256, return_tensors="pt"
196
  ).to(device)["input_ids"]
197
+
198
  output = model(tokens)
199
  output_norm = softmax(output.logits.detach().cpu().numpy(), 1)[0]
200
  print("BC Score: ", output_norm)