Spaces:
Runtime error
Runtime error
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") | |
today = datetime.datetime.now() | |
next_year = today.year + 1 | |
jan_1 = datetime.date(next_year, 1, 1) | |
dec_31 = datetime.date(next_year, 12, 31) | |
d = st.date_input( | |
"Select the date range", | |
(jan_1, datetime.date(next_year, 1, 7)), | |
jan_1, | |
dec_31, | |
format="MM.DD.YYYY", | |
) | |
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) | |