Spaces:
Runtime error
Runtime error
ZarahShibli
commited on
Commit
•
685440f
1
Parent(s):
254320e
Update app.py
Browse files
app.py
CHANGED
@@ -12,6 +12,7 @@ models = {}
|
|
12 |
model = AutoModel.from_pretrained(f'ZarahShibli/tmp_trainer',return_dict=False)
|
13 |
|
14 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
|
|
15 |
MAX_LEN = 200
|
16 |
|
17 |
tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased', return_tensors='pt')
|
@@ -45,9 +46,9 @@ def predict(comment_sentence):
|
|
45 |
with torch.no_grad():
|
46 |
outputs = model(ids, mask, token_type_ids)
|
47 |
|
48 |
-
|
49 |
-
|
50 |
-
|
51 |
print(fin_outputs)
|
52 |
# Convert the outputs to boolean values based on the threshold
|
53 |
outputs_boolean = np.array(fin_outputs) >= 0.25
|
|
|
12 |
model = AutoModel.from_pretrained(f'ZarahShibli/tmp_trainer',return_dict=False)
|
13 |
|
14 |
device = 'cuda' if torch.cuda.is_available() else 'cpu'
|
15 |
+
print("device",device)
|
16 |
MAX_LEN = 200
|
17 |
|
18 |
tokenizer = AutoTokenizer.from_pretrained('bert-base-uncased', return_tensors='pt')
|
|
|
46 |
with torch.no_grad():
|
47 |
outputs = model(ids, mask, token_type_ids)
|
48 |
|
49 |
+
|
50 |
+
print(outputs)
|
51 |
+
fin_outputs.extend(torch.sigmoid(outputs).detach().numpy().tolist())
|
52 |
print(fin_outputs)
|
53 |
# Convert the outputs to boolean values based on the threshold
|
54 |
outputs_boolean = np.array(fin_outputs) >= 0.25
|