accentt / src /streamlit_app.py
wesam0099's picture
Update src/streamlit_app.py
646cec2 verified
raw
history blame contribute delete
914 Bytes
import sys
sys.path.append("src")
from agent import AccentAgent
import streamlit as st
st.set_page_config(page_title="AI Accent Agent", layout="centered")
st.title("🧠 AI Agent: Accent Classifier")
st.markdown("Upload your voice recording and let the AI detect your accent!")
uploaded_file = st.file_uploader("πŸ“€ Upload audio file", type=["wav", "mp3", "m4a"])
if uploaded_file is not None:
with open("temp_audio.wav", "wb") as f:
f.write(uploaded_file.read())
agent = AccentAgent(audio_path="temp_audio.wav")
with st.spinner("Analyzing audio..."):
try:
result = agent.run()
st.audio(result["audio_path"], format="audio/wav")
st.success(f"🎯 **Detected Accent:** {result['accent']}")
st.markdown(f"πŸ“ **Transcribed Text:** {result['transcription']}")
except Exception as e:
st.error(f"❌ Error: {e}")