awacke1 commited on
Commit
9d38a5a
Β·
verified Β·
1 Parent(s): 108fd33

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -37,6 +37,10 @@ from streamlit_marquee import streamlit_marquee
37
  from typing import Tuple, Optional
38
  import pandas as pd
39
 
 
 
 
 
40
  # ─────────────────────────────────────────────────────────
41
  # 1. CORE CONFIGURATION & SETUP
42
  # ─────────────────────────────────────────────────────────
@@ -600,7 +604,7 @@ def create_download_link_with_cache(file_path: str, file_type: str = "mp3") -> s
600
  # NEW: Define play_and_download_audio to play audio and provide a download link.
601
  def play_and_download_audio(file_path, file_type="mp3"):
602
  """Streamlit audio + a quick download link."""
603
- if file_path and os.path.exists(file_path):
604
  st.audio(file_path)
605
  dl_link = get_download_link(file_path, file_type=file_type)
606
  st.markdown(dl_link, unsafe_allow_html=True)
@@ -1205,7 +1209,7 @@ def main():
1205
  with st.expander(os.path.basename(a)):
1206
  st.audio(a)
1207
  ext = os.path.splitext(a)[1].replace('.', '')
1208
- dl_link = create_download_link_with_cache(a, file_type=ext)
1209
  st.markdown(dl_link, unsafe_allow_html=True)
1210
  else:
1211
  st.write("No audio files found.")
 
37
  from typing import Tuple, Optional
38
  import pandas as pd
39
 
40
+ # Patch the asyncio event loop to allow nested use of asyncio.run()
41
+ import nest_asyncio
42
+ nest_asyncio.apply()
43
+
44
  # ─────────────────────────────────────────────────────────
45
  # 1. CORE CONFIGURATION & SETUP
46
  # ─────────────────────────────────────────────────────────
 
604
  # NEW: Define play_and_download_audio to play audio and provide a download link.
605
  def play_and_download_audio(file_path, file_type="mp3"):
606
  """Streamlit audio + a quick download link."""
607
+ if file_path and isinstance(file_path, str) and os.path.exists(file_path):
608
  st.audio(file_path)
609
  dl_link = get_download_link(file_path, file_type=file_type)
610
  st.markdown(dl_link, unsafe_allow_html=True)
 
1209
  with st.expander(os.path.basename(a)):
1210
  st.audio(a)
1211
  ext = os.path.splitext(a)[1].replace('.', '')
1212
+ dl_link = get_download_link(a, file_type=ext)
1213
  st.markdown(dl_link, unsafe_allow_html=True)
1214
  else:
1215
  st.write("No audio files found.")