karthigrj commited on
Commit
4e31df1
·
verified ·
1 Parent(s): 4850901

Update src/streamlit_app.py

Browse files
Files changed (1) hide show
  1. src/streamlit_app.py +39 -1
src/streamlit_app.py CHANGED
@@ -212,4 +212,42 @@ if audio_file and st.button("Process Audio", type="primary"):
212
 
213
  try:
214
  with st.spinner("Transcribing..."):
215
- if transcription_model == "Groq (Wh
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
212
 
213
  try:
214
  with st.spinner("Transcribing..."):
215
+ if transcription_model == "Groq (Whisper)":
216
+ transcription = transcribe_with_groq(temp_file_path)
217
+ else:
218
+ transcription = transcribe_with_elevenlabs(temp_file_path)
219
+
220
+ if transcription:
221
+ st.subheader("Transcription")
222
+ st.text_area("Transcript", transcription, height=150, label_visibility="collapsed")
223
+
224
+ with st.spinner("Analyzing content..."):
225
+ entities = extract_entities_with_llama(transcription)
226
+
227
+ st.subheader("Structured Output")
228
+
229
+ col1, col2 = st.columns(2)
230
+ with col1:
231
+ st.json(entities, expanded=True)
232
+
233
+ with col2:
234
+ st.metric("Detected Intent",
235
+ value=entities["intent"],
236
+ help=f"Confidence: {entities['intent_confidence']:.2f}")
237
+
238
+ for category, emoji in [("person_name", "👤"),
239
+ ("place", "📍"),
240
+ ("phone_number", "📞"),
241
+ ("skills", "🛠️")]:
242
+ if entities[category]:
243
+ st.write(f"{emoji} **{category.replace('_', ' ').title()}**")
244
+ for item in entities[category]:
245
+ st.write(f"- {item}")
246
+
247
+ finally:
248
+ # Clean up the temporary file
249
+ if temp_file_path and os.path.exists(temp_file_path):
250
+ try:
251
+ os.unlink(temp_file_path)
252
+ except Exception as e:
253
+ st.warning(f"Could not delete temporary file: {str(e)}")