File size: 545 Bytes
879a213
1e6f560
879a213
1e6f560
 
 
 
 
 
879a213
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
import streamlit as st
from transformers import AutoTokenizer, AutoModelForSequenceClassification, Trainer

model_name =  "mrm8488/distilroberta-finetuned-financial-news-sentiment-analysis"
model = AutoModelForSequenceClassification.from_pretrained(model_name)
tokenizer = AutoTokenizer.from_pretrained(model_name)

pipe = TextClassificationPipeline(model=model, tokenizer=tokenizer, return_all_scores=True)
text = st.text_area(f'Ciao! This app uses {model_name}. Enter your text  to test it ❤️')

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