File size: 1,782 Bytes
5f93bf1
 
 
 
 
 
 
 
 
 
 
 
b98d539
5f93bf1
b98d539
2e838e1
812904c
b98d539
 
 
5f93bf1
 
 
 
 
 
 
 
7a86130
5f93bf1
 
b98d539
5f93bf1
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
import gradio as gr

from SER import live_emotion_recognition
from MT import search_song_by_emotion

def audio_interface(audio):
    emotion = live_emotion_recognition(audio)
    preview_url = search_song_by_emotion(emotion)
    if preview_url:
      audio = gr.Audio(value=preview_url,label="Recommend Music 🎷")
      return emotion,audio
    else:
      return emotion,gr.Audio(value=None,label="Please click Submit again to refresh 🔄")

description = """ **"Feel the Music, Heal the Soul"**
\n**Authors: Soham Ghosh and Sk Rajibul Islam**
\nThis project is all about using music to make you feel better. We listen to the way you speak and figure out if you're feeling happy, sad, angry or anything else. Then, we suggest some classic Indian instrumental music that can help lift your mood.
\nThe special thing is, this music is chosen just for you based on how you're feeling at that moment. If you're stressed, we'll pick some calming ragas. If you're down, we'll find some uplifting tunes to cheer you up.
\nAnd it doesn't stop there! Just hit that 'Submit' button again, and we'll give you a brand new music recommendation. It's like having your own personal music therapist, but without the therapy couch.
\nSo let the melodies move you, one note at a time. Who knows, you might just find your rhythm again!"""

css = """
#container{
    margin: 0 auto;
    max-width: 80rem;
}
"""

iface = gr.Interface (title='Sentiment based Music Therapy',
                      description=description,
                      fn=audio_interface,
                      inputs=[gr.Audio(sources='microphone', type='filepath',label="Unveil Your Soul ✨")],
                      outputs=[gr.Textbox(label="Detected Emotion "),gr.Audio(label="Recommended Music 🎷")])

iface.launch()