7H4M3R commited on
Commit
86475f2
·
verified ·
1 Parent(s): 9f6fcf3

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +10 -10
src/streamlit_app.py CHANGED
@@ -112,22 +112,22 @@ if st.button("Analyze"):
112
  st.write("Exists:", os.path.exists(audio_path))
113
  # pass
114
 
115
- with st.spinner("Transcribing with Whisper..."):
116
- whisper_model = whisper.load_model("base")
117
- result = whisper_model.transcribe(audio_path)
118
- transcription = result['text']
119
  # transcription = "Hello There"
120
  # pass
121
 
122
  with st.spinner("Classifying accent..."):
123
- # model_name = "dima806/english_accents_classification"
124
- # pipe = pipeline('audio-classification', model=model_name, device=0) # GPU (device=0) or CPU (device=-1)
125
- # accent_data = accent_classify(pipe, audio_path)
126
 
127
  # audio_df = split_audio(audio_path)
128
  # print(np.concatenate(audio_df["audio"][:50].to_list()))
129
 
130
- accent_data = {"label": "us", "score": 0.9}
131
  accent = accent_data.get("label", "American")
132
  confidence = accent_data.get("score", 0.0)
133
  # pass
@@ -135,8 +135,8 @@ if st.button("Analyze"):
135
  st.success("Analysis Complete!")
136
  st.markdown(f"**Accent:** {accent}")
137
  st.markdown(f"**Confidence Score:** {confidence:.2f}%")
138
- st.markdown("**Transcription:**")
139
- st.text_area("Transcript", transcription, height=200)
140
 
141
  # Cleanup
142
  os.remove(video_path)
 
112
  st.write("Exists:", os.path.exists(audio_path))
113
  # pass
114
 
115
+ # with st.spinner("Transcribing with Whisper..."):
116
+ # whisper_model = whisper.load_model("base")
117
+ # result = whisper_model.transcribe(audio_path)
118
+ # transcription = result['text']
119
  # transcription = "Hello There"
120
  # pass
121
 
122
  with st.spinner("Classifying accent..."):
123
+ model_name = "dima806/english_accents_classification"
124
+ pipe = pipeline('audio-classification', model=model_name, device=-1) # GPU (device=0) or CPU (device=-1)
125
+ accent_data = accent_classify(pipe, audio_path)
126
 
127
  # audio_df = split_audio(audio_path)
128
  # print(np.concatenate(audio_df["audio"][:50].to_list()))
129
 
130
+ # accent_data = {"label": "us", "score": 0.9}
131
  accent = accent_data.get("label", "American")
132
  confidence = accent_data.get("score", 0.0)
133
  # pass
 
135
  st.success("Analysis Complete!")
136
  st.markdown(f"**Accent:** {accent}")
137
  st.markdown(f"**Confidence Score:** {confidence:.2f}%")
138
+ # st.markdown("**Transcription:**")
139
+ # st.text_area("Transcript", transcription, height=200)
140
 
141
  # Cleanup
142
  os.remove(video_path)