awacke1 commited on
Commit
8674fea
Β·
verified Β·
1 Parent(s): b434a4f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -3
app.py CHANGED
@@ -430,14 +430,16 @@ def FileSidebar():
430
  for file in all_files:
431
  ext = os.path.splitext(file)[1].lower()
432
  col1, col2, col3, col4, col5 = st.sidebar.columns([1, 6, 1, 1, 1])
 
433
  with col1:
434
  icon = "πŸ“œ" if ext == ".md" else "πŸ“„" if ext == ".pdf" else "πŸ–ΌοΈ" if ext in [".png", ".jpg", ".jpeg"] else "🎡" if ext in [".wav", ".mp3"] else "πŸŽ₯" if ext == ".mp4" else "πŸ“Ž"
435
  if st.button(icon, key=f"view_{file}"):
436
  with open(file, "rb") as f:
437
  content = f.read()
438
  if ext == ".md":
439
- st.markdown(content.decode("utf-8"))
440
- SpeechSynthesis(content.decode("utf-8"))
 
441
  elif ext == ".pdf":
442
  st.download_button("Download PDF", content, file, "application/pdf")
443
  st.write("PDF Viewer not natively supported; download to view.")
@@ -472,7 +474,10 @@ def FileSidebar():
472
  if st.button("πŸ—‘", key=f"delete_{file}"):
473
  os.remove(file)
474
  st.rerun()
475
-
 
 
 
476
  def create_zip_of_files(files):
477
  zip_name = "Files.zip"
478
  with zipfile.ZipFile(zip_name, 'w') as zipf:
 
430
  for file in all_files:
431
  ext = os.path.splitext(file)[1].lower()
432
  col1, col2, col3, col4, col5 = st.sidebar.columns([1, 6, 1, 1, 1])
433
+ colFollowUp=""
434
  with col1:
435
  icon = "πŸ“œ" if ext == ".md" else "πŸ“„" if ext == ".pdf" else "πŸ–ΌοΈ" if ext in [".png", ".jpg", ".jpeg"] else "🎡" if ext in [".wav", ".mp3"] else "πŸŽ₯" if ext == ".mp4" else "πŸ“Ž"
436
  if st.button(icon, key=f"view_{file}"):
437
  with open(file, "rb") as f:
438
  content = f.read()
439
  if ext == ".md":
440
+ colFollowUp=ext
441
+ #st.markdown(content.decode("utf-8"))
442
+ #SpeechSynthesis(content.decode("utf-8"))
443
  elif ext == ".pdf":
444
  st.download_button("Download PDF", content, file, "application/pdf")
445
  st.write("PDF Viewer not natively supported; download to view.")
 
474
  if st.button("πŸ—‘", key=f"delete_{file}"):
475
  os.remove(file)
476
  st.rerun()
477
+ if colFollowUp == ".md":
478
+ colFollowUp=ext
479
+ st.markdown(content.decode("utf-8"))
480
+ SpeechSynthesis(content.decode("utf-8"))
481
  def create_zip_of_files(files):
482
  zip_name = "Files.zip"
483
  with zipfile.ZipFile(zip_name, 'w') as zipf: