shawarmabytes's picture
Update app.py
1cd7ed4
raw
history blame
945 Bytes
import streamlit.components.v1 as components
from streamlit_player import st_player
from transformers import pipeline
import streamlit as st
import random
def tester(text):
classifier = pipeline("sentiment-analysis", model='bhadresh-savani/distilbert-base-uncased-emotion')
results = classifier(text)
#st.subheader(results[0]['label'])
#tester(emo)
with st.form(key="form1"):
emo = st.text_input("Enter a text/phrase/sentence. A corresponding song will be recommended based on its emotion.", placeholder="tester po")
submit = st.form_submit_button("Generate Playlist!")
tester(emo)
#def finder(ome):
generator = st.button("Generate Song!")
if (generator == True):
elif (results[0]['label']=="anger"): #songs for anger emotion
with open('angryplaylist.txt') as f:
contents = f.read()
components.html(contents,width=560,height=325)
#finder(tester(emo))