Spaces:
Paused
Paused
CountingMstar
commited on
Commit
•
ca6ca1c
1
Parent(s):
32a4ae2
Update app.py
Browse files
app.py
CHANGED
@@ -5,10 +5,10 @@ import torch
|
|
5 |
from nltk.tokenize import word_tokenize
|
6 |
import timm
|
7 |
|
|
|
8 |
tokenizer = BertTokenizerFast.from_pretrained('bert-base-uncased')
|
9 |
#model = BertForQuestionAnswering.from_pretrained("bert-base-uncased")
|
10 |
-
model = BertForQuestionAnswering.from_pretrained("CountingMstar/ai-tutor-bert-model")
|
11 |
-
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
12 |
|
13 |
def get_prediction(context, question):
|
14 |
inputs = tokenizer.encode_plus(question, context, return_tensors='pt').to(device)
|
|
|
5 |
from nltk.tokenize import word_tokenize
|
6 |
import timm
|
7 |
|
8 |
+
device = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
|
9 |
tokenizer = BertTokenizerFast.from_pretrained('bert-base-uncased')
|
10 |
#model = BertForQuestionAnswering.from_pretrained("bert-base-uncased")
|
11 |
+
model = BertForQuestionAnswering.from_pretrained("CountingMstar/ai-tutor-bert-model").to(device)
|
|
|
12 |
|
13 |
def get_prediction(context, question):
|
14 |
inputs = tokenizer.encode_plus(question, context, return_tensors='pt').to(device)
|