Update src/streamlit_app.py
Browse files- src/streamlit_app.py +9 -6
src/streamlit_app.py
CHANGED
@@ -7,14 +7,17 @@ import streamlit as st
|
|
7 |
|
8 |
st.set_page_config(page_title="AI Accent Agent", layout="centered")
|
9 |
st.title("π§ AI Agent: Accent Classifier")
|
10 |
-
st.markdown("
|
11 |
|
12 |
-
|
13 |
|
14 |
-
if
|
15 |
-
|
|
|
16 |
|
17 |
-
|
|
|
|
|
18 |
try:
|
19 |
result = agent.run()
|
20 |
|
@@ -23,4 +26,4 @@ if st.button("ποΈ Start Agent"):
|
|
23 |
st.markdown(f"π **Transcribed Text:** {result['transcription']}")
|
24 |
|
25 |
except Exception as e:
|
26 |
-
st.error(f"β
|
|
|
7 |
|
8 |
st.set_page_config(page_title="AI Accent Agent", layout="centered")
|
9 |
st.title("π§ AI Agent: Accent Classifier")
|
10 |
+
st.markdown("Upload your voice file and let our AI detect the accent! π€")
|
11 |
|
12 |
+
uploaded_file = st.file_uploader("π€ Upload audio file", type=["wav", "mp3", "m4a"])
|
13 |
|
14 |
+
if uploaded_file is not None:
|
15 |
+
with open("temp_audio.wav", "wb") as f:
|
16 |
+
f.write(uploaded_file.read())
|
17 |
|
18 |
+
agent = AccentAgent(audio_path="temp_audio.wav")
|
19 |
+
|
20 |
+
with st.spinner("Processing..."):
|
21 |
try:
|
22 |
result = agent.run()
|
23 |
|
|
|
26 |
st.markdown(f"π **Transcribed Text:** {result['transcription']}")
|
27 |
|
28 |
except Exception as e:
|
29 |
+
st.error(f"β Error: {e}")
|