File size: 441 Bytes
ba0175e a542854 ba0175e a542854 |
1 2 3 4 5 6 7 8 9 10 |
import streamlit as st
from transformers import BertTokenizer, BertForSequenceClassification, pipeline
finbert = BertForSequenceClassification.from_pretrained('yiyanghkust/finbert-esg',num_labels=4)
tokenizer = BertTokenizer.from_pretrained('yiyanghkust/finbert-esg')
nlp = pipeline("text-classification", model=finbert, tokenizer=tokenizer)
text = []
text = st.text_area('enter some text:')
if text:
results = nlp(text)
st.json(results) |