Spaces:
Sleeping
Sleeping
| import streamlit as st | |
| from transformers import pipeline | |
| # Buat title pada web apps | |
| st.title("Sentiment Analysis App") | |
| st.markdown("You can input 8 different language: arabic, english, french, german, hindi, italian, portuguese, spanish") | |
| # Buat text input dari user | |
| text = st.text_input("Enter text here", "I love you") | |
| # Model initiate | |
| pipeline = pipeline(task='text-classification', model='cardiffnlp/twitter-xlm-roberta-base-sentiment-multilingual') | |
| if st.button("Analyze"): | |
| result = pipeline(text)[0] | |
| sentiment = result['label'] | |
| score = result['score'] | |
| st.write(f"Sentiment: {sentiment}") | |
| if score is not None: | |
| st.write(f"Score: {score}") | |