import streamlit as st from transformers import AutoModelForSequenceClassification from transformers import AutoTokenizer from transformers import TextClassificationPipeline @st.cache_data() def get_pipe(): model = AutoModelForSequenceClassification.from_pretrained( "issai/rembert-sentiment-analysis-polarity-classification-kazakh") tokenizer = AutoTokenizer.from_pretrained("issai/rembert-sentiment-analysis-polarity-classification-kazakh") return TextClassificationPipeline(model=model, tokenizer=tokenizer) pipe = get_pipe() st.title('KazSandra@ISSAI') st.text('Sentiment Analysis Polarity Classification In Kazakh Language.') input_text = st.text_area('Input text', placeholder='Provide your text', value='Осы кітап қызық сияқты.') # reviews = ["Бұл бейнефильм маған түк ұнамады.", "Осы кітап қызық сияқты."] # for review in reviews: if input_text: out = pipe(input_text)[0] st.text("Label: {label}\nScore: {score}".format(**out))