wesam0099 commited on
Commit
287b16c
Β·
verified Β·
1 Parent(s): 84b3610

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. 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("Record your voice and let our AI agent handle the rest! πŸ€–")
11
 
12
- duration = st.slider("⏱️ Recording Duration (seconds)", 3, 10, 5)
13
 
14
- if st.button("πŸŽ™οΈ Start Agent"):
15
- agent = AccentAgent(duration=duration)
 
16
 
17
- with st.spinner("Agent is processing..."):
 
 
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"❌ Agent Error: {e}")
 
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}")