DEV Community

Cover image for I built an App that judges your face to play music (So you don't have to scroll Spotify) 🎧
SRIHARI P V
SRIHARI P V

Posted on

I built an App that judges your face to play music (So you don't have to scroll Spotify) 🎧

We've all been there. You open Spotify or YouTube, stare at your 47 different playlists, and spend 15 minutes trying to figure out if your current existential dread requires Lo-Fi Beats or Heavy Metal.

I decided that making decisions is overrated. Why not let a neural network look at your face and decide how you feel instead?

Say hello to Viso Vibe: https://viso-vibe.streamlit.app/

On the outside, it looks like a sleek, high-end, premium audio interface. On the inside? It’s a beautifully stitched-together monster of Python, custom JavaScript hacks, and ONNX models running inside a container.

Here is exactly how this absolute unit of an app works:

The Streamlit Catfish Frontend: Streamlit is amazing for data apps, but it usually looks like... a data app. I didn't want that. So, I brutally injected raw HTML, CSS, and JS to completely murder the default styling. Custom #06060F dark background? Checked. Noise textures? Checked. Turning a standard file/camera input into a glowing, animated shutter button? Absolutely.

The Dual-Model Brains (ONNX): When you click that glowing shutter, your photo is converted into a NumPy array and fed into the pipeline. First, detection.onnx hunts down your face, draws a box, and crops it. Then, emotion.onnx uses a neural network (HSEmotionRecognizer) to analyze your facial muscles and calculate a probability score across 7 baseline emotions.

The Emotional Router: To avoid choice paralysis, I boiled human emotion down into 4 distinct musical lanes:

1.Happiness/Surprise βž” Happy (Solar Palette β˜€οΈ)

2.Sadness βž” Sad (Cobalt Palette 🌊)

3.Anger/Disgust/Fear βž” Angry (Crimson Palette πŸ”₯)

4.Neutral βž” Calm (Sage Palette 🌿)

The Passive-Aggressive Feedback: Before the track even starts, Google Text-to-Speech (gTTS) generates a custom voice track saying, "You seem [emotion]. Let me play something for you." It base64 encodes it into an invisible HTML tag to voice-line you the second the page updates.

The Ninja Media Player: Streamlit's audio players are static and boring. So, I used streamlit.components.v1.html to inject a massive custom UI card. It renders an HTML canvas orbital visualizer with floating particles and reactive audio bars. To get the actual music, a completely hidden div loads the official YouTube IFrame API. The app triggers a random index between 0 and 50 within my curated mood playlists, and the custom player buttons pipe invisible commands like player.playVideo() right to the hidden YouTube element. No YouTube player layout visible, just vibes.

πŸ”₯ Try it out & Roast/Review it!
It is live right now: πŸ‘‰ https://viso-vibe.streamlit.app/

Go ahead, try to fake a smile to get a happy playlist, or give it your worst Monday morning stare to trigger the Angry (Tamil Mass Beats) queue.

I need your help with two things:

Playlist Suggestions: What absolute bangers, deep-cut YouTube mixes, or hidden lo-fi tracks am I missing? Tell me what needs to go into the Happy, Calm, Sad, or Angry databases!

Code Roast: Tell me what you think of using hidden IFrames and raw JS to bypass UI limitations.

Drop your thoughts and playlist recommendations in the comments! πŸ‘‡

Top comments (3)

Collapse
 
shobanchiddarth profile image
Shoban Chiddarth

No matter what emotion I have it always says calm

Collapse
 
srihari_p_v profile image
SRIHARI P V

I guess then you have calm emotions only

Collapse
 
shobanchiddarth profile image
Shoban Chiddarth

I tried forcing angry emotion