Josedcape commited on
Commit
a023902
verified
1 Parent(s): ad8f424

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +16 -3
app.py CHANGED
@@ -7,7 +7,8 @@ from datetime import datetime, timedelta
7
  from streamlit_autorefresh import st_autorefresh
8
  import requests
9
  import base64
10
- from groq import Groq # Importamos Groq como mencionaste
 
11
 
12
  # Configurar la p谩gina de Streamlit
13
  st.set_page_config(page_title="Galatea Asistente - OMARDENT", layout="wide")
@@ -133,10 +134,22 @@ def mostrar_galatea_asistente():
133
  audio_bytes = audio_file.read()
134
  st.audio(audio_bytes, format="audio/mp3")
135
 
 
 
 
 
 
 
 
 
 
 
 
 
 
136
  # Funci贸n principal
137
  def main():
138
  mostrar_galatea_asistente()
139
 
140
  if __name__ == "__main__":
141
- main()
142
-
 
7
  from streamlit_autorefresh import st_autorefresh
8
  import requests
9
  import base64
10
+ from groq import Groq
11
+ import threading # Importamos threading para crear el agente que interact煤e con el bot贸n
12
 
13
  # Configurar la p谩gina de Streamlit
14
  st.set_page_config(page_title="Galatea Asistente - OMARDENT", layout="wide")
 
134
  audio_bytes = audio_file.read()
135
  st.audio(audio_bytes, format="audio/mp3")
136
 
137
+ # Crear un agente que se encargue de presionar el bot贸n de reproducci贸n al finalizar el contador
138
+ def agente_reproducir_audio():
139
+ while True:
140
+ time.sleep(intervalo) # Esperar el intervalo especificado por el usuario
141
+ if 'audio_file_path' in locals() and audio_file_path:
142
+ with open(audio_file_path, "rb") as audio_file:
143
+ audio_bytes = audio_file.read()
144
+ st.audio(audio_bytes, format="audio/mp3")
145
+
146
+ # Crear un hilo para el agente que reproduce el audio autom谩ticamente
147
+ agente_hilo = threading.Thread(target=agente_reproducir_audio, daemon=True)
148
+ agente_hilo.start()
149
+
150
  # Funci贸n principal
151
  def main():
152
  mostrar_galatea_asistente()
153
 
154
  if __name__ == "__main__":
155
+ main()