Spaces:
Runtime error
Runtime error
Commit ·
d8afe0b
1
Parent(s): 2ce0e18
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,7 +9,6 @@ from PIL import Image
|
|
| 9 |
with open('labels.pickle', 'rb') as handle:
|
| 10 |
labels = pickle.load(handle)
|
| 11 |
|
| 12 |
-
@st.cache
|
| 13 |
def predict_topic_by_title_and_abstract(text, model):
|
| 14 |
tokens = tokenizer(text, return_tensors='pt', truncation=True)
|
| 15 |
with torch.no_grad():
|
|
@@ -27,12 +26,6 @@ def predict_topic_by_title_and_abstract(text, model):
|
|
| 27 |
|
| 28 |
tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased")
|
| 29 |
|
| 30 |
-
#model = AutoModelForSequenceClassification.from_pretrained("distilbert-base-uncased", num_labels=8)
|
| 31 |
-
#model.load_state_dict(
|
| 32 |
-
# torch.load(
|
| 33 |
-
# "./trained_model"
|
| 34 |
-
# )
|
| 35 |
-
#)
|
| 36 |
with open('trained_model.pickle', 'rb') as handle:
|
| 37 |
model = pickle.load(handle)
|
| 38 |
|
|
|
|
| 9 |
with open('labels.pickle', 'rb') as handle:
|
| 10 |
labels = pickle.load(handle)
|
| 11 |
|
|
|
|
| 12 |
def predict_topic_by_title_and_abstract(text, model):
|
| 13 |
tokens = tokenizer(text, return_tensors='pt', truncation=True)
|
| 14 |
with torch.no_grad():
|
|
|
|
| 26 |
|
| 27 |
tokenizer = AutoTokenizer.from_pretrained("distilbert-base-uncased")
|
| 28 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
with open('trained_model.pickle', 'rb') as handle:
|
| 30 |
model = pickle.load(handle)
|
| 31 |
|