Update app.py
Browse files
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 |
-
|
440 |
-
|
|
|
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:
|