walaa2022 commited on
Commit
477a67c
·
verified ·
1 Parent(s): 1dd3718

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -1
app.py CHANGED
@@ -79,7 +79,16 @@ def generate_ai_response(prompt, simulate=True):
79
  return "Sorry, I couldn't generate a response at this time."
80
 
81
 
82
-
 
 
 
 
 
 
 
 
 
83
  def generate_voice_response(text, simulate=True):
84
  """Generate voice response using ElevenLabs API"""
85
  if simulate:
 
79
  return "Sorry, I couldn't generate a response at this time."
80
 
81
 
82
+ def autoplay_audio(audio_content):
83
+ """Generate HTML with audio player that auto-plays"""
84
+ b64 = base64.b64encode(audio_content).decode()
85
+ md = f"""
86
+ <audio controls autoplay>
87
+ <source src="data:audio/mp3;base64,{b64}" type="audio/mp3">
88
+ </audio>
89
+ """
90
+ st.markdown(md, unsafe_allow_html=True)
91
+
92
  def generate_voice_response(text, simulate=True):
93
  """Generate voice response using ElevenLabs API"""
94
  if simulate: