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}") | |