Spaces:
Runtime error
Runtime error
Update utils.py
Browse files
utils.py
CHANGED
|
@@ -1,4 +1,5 @@
|
|
| 1 |
import torch
|
|
|
|
| 2 |
|
| 3 |
|
| 4 |
def get_text(title: str, abstract: str):
|
|
@@ -29,5 +30,8 @@ def get_labels(text, model, tokenizer, count_labels=8):
|
|
| 29 |
if cumsum > 0.95 and len(result_labels) >= 1:
|
| 30 |
return result_labels
|
| 31 |
result_labels.append(pair[1])
|
| 32 |
-
|
|
|
|
|
|
|
|
|
|
| 33 |
|
|
|
|
| 1 |
import torch
|
| 2 |
+
import streamlit as st
|
| 3 |
|
| 4 |
|
| 5 |
def get_text(title: str, abstract: str):
|
|
|
|
| 30 |
if cumsum > 0.95 and len(result_labels) >= 1:
|
| 31 |
return result_labels
|
| 32 |
result_labels.append(pair[1])
|
| 33 |
+
|
| 34 |
+
@st.cache
|
| 35 |
+
def load_model(model, filename):
|
| 36 |
+
return model.load_state_dict(torch.load(filename))
|
| 37 |
|