import streamlit as st from streamlit_player import st_player from transformers import pipeline def tester(text): #classifier = pipeline("sentiment-analysis", model='arpanghoshal/EmoRoBERTa') #classifier = pipeline("sentiment-analysis", model='cardiffnlp/twitter-roberta-base-emotion') #classifier = pipeline("sentiment-analysis", 'j-hartmann/emotion-english-distilroberta-base') classifier = pipeline("sentiment-analysis", model='cardiffnlp/twitter-roberta-base-emotion') results = classifier(text) st.write(results[0]['label']) if (results[0]['label']=="anger"): st_player("https://youtu.be/CmSKVW1v0xM") elif (results[0]['label']=="disgust"): st_player("https://youtu.be/CmSKVW1v0xM") elif (results[0]['label']=="fear"): st_player("https://youtu.be/CmSKVW1v0xM") elif (results[0]['label']=="joy"): st_player("https://youtu.be/CmSKVW1v0xM") elif (results[0]['label']=="sadness"): st_player("https://open.spotify.com/playlist/37i9dQZF1E4s6KXygylRFz") elif (results[0]['label']=="surprise"): st_player("https://youtu.be/CmSKVW1v0xM") return results[0]['label'] #return results emo = st.text_input('Enter text here:') tester(emo)