File size: 606 Bytes
2dd7bee
 
5e200ff
 
2dd7bee
5e200ff
cdda580
5e200ff
 
 
 
 
 
2dd7bee
 
 
 
5e200ff
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import streamlit as st
from transformers import pipeline
import torch
from transformers import AutoTokenizer, AutoModelForSequenceClassification

device = torch.device("cuda" if torch.cuda.is_available() else "cpu")


tokenizer = AutoTokenizer.from_pretrained("nickmuchi/sec-bert-finetuned-finance-classification")
model = AutoModelForSequenceClassification.from_pretrained("nickmuchi/sec-bert-finetuned-finance-classification")


pipe = pipeline("text-classification", model=model, tokenizer=tokenizer, device=device)
text = st.text_area("Enter some text")

if text:
    out = pipe(text)
    st.json(out)