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) |