Spaces:
Runtime error
Runtime error
Commit ·
fa574e6
1
Parent(s): 6a8a7ab
Update app.py
Browse files
app.py
CHANGED
|
@@ -10,7 +10,7 @@ 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):
|
| 14 |
tokens = tokenizer(text, return_tensors='pt', truncation=True)
|
| 15 |
with torch.no_grad():
|
| 16 |
logits = model(**tokens).logits
|
|
@@ -53,4 +53,4 @@ input_text = title + " " + abstract
|
|
| 53 |
input_text = ''.join(filter(str.isalnum, input_text))
|
| 54 |
|
| 55 |
if len(input_text.split()) > 0:
|
| 56 |
-
predict_topic_by_title_and_abstract(input_text)
|
|
|
|
| 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():
|
| 16 |
logits = model(**tokens).logits
|
|
|
|
| 53 |
input_text = ''.join(filter(str.isalnum, input_text))
|
| 54 |
|
| 55 |
if len(input_text.split()) > 0:
|
| 56 |
+
predict_topic_by_title_and_abstract(input_text, model)
|