File size: 362 Bytes
3b57a52 c240b4b 3b57a52 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
from transformers import pipeline
import torch
import streamlit as st
from random import shuffle
@st.cache_data
def load_sentences():
with open("sentences.pt", 'rb') as f:
x = torch.load(f)
shuffle(x)
return x
@st.cache_resource
def load_model(model):
return pipeline("ner",
model=model,
aggregation_strategy="average"
) |