jc047 commited on
Commit
3b277e3
·
verified ·
1 Parent(s): d504b9a

Create emotion_detector.py

Browse files
Files changed (1) hide show
  1. src/emotion_detector.py +18 -0
src/emotion_detector.py ADDED
@@ -0,0 +1,18 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from emotion_detector import detect_emotion
3
+
4
+ st.set_page_config(page_title="Real-Time Emotion to Emoji", page_icon="🎧")
5
+ st.title("🎧 Real-Time Emotion to Emoji")
6
+
7
+ st.markdown("""
8
+ Upload a 5-second **WAV** audio clip of your voice, and the AI will detect your emotion and show an emoji!
9
+ """)
10
+
11
+ uploaded_file = st.file_uploader("📤 Upload your 5-second WAV audio", type=["wav"])
12
+
13
+ if uploaded_file is not None:
14
+ st.audio(uploaded_file, format='audio/wav')
15
+
16
+ with st.spinner("Detecting emotion..."):
17
+ emotion, emoji = detect_emotion(uploaded_file)
18
+ st.markdown(f"## {emoji} Emotion: **{emotion.title()}**")