Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -622,42 +622,46 @@ def create_media_gallery():
|
|
622 |
# Here you could integrate with image generation API
|
623 |
st.write(f"Generated scene description for {bike_name}:")
|
624 |
st.write(prompt)
|
|
|
625 |
def display_file_manager():
|
626 |
-
"""Display file management sidebar with unique button keys."""
|
627 |
st.sidebar.title("π File Management")
|
628 |
|
629 |
all_files = glob.glob("*.md")
|
630 |
all_files.sort(reverse=True)
|
631 |
|
632 |
-
|
633 |
-
if st.sidebar.button("π Delete All", key="delete_all_files"):
|
634 |
for file in all_files:
|
635 |
os.remove(file)
|
636 |
st.rerun()
|
637 |
|
638 |
-
|
639 |
-
if st.sidebar.button("β¬οΈ Download All", key="download_all_files"):
|
640 |
zip_file = create_zip_of_files(all_files)
|
641 |
st.sidebar.markdown(get_download_link(zip_file), unsafe_allow_html=True)
|
642 |
|
643 |
-
#
|
644 |
-
for file in all_files:
|
|
|
|
|
|
|
|
|
645 |
col1, col2, col3, col4 = st.sidebar.columns([1,3,1,1])
|
646 |
with col1:
|
647 |
-
if st.button("π", key=f"view_{
|
648 |
st.session_state.current_file = file
|
649 |
st.session_state.file_content = load_file(file)
|
650 |
with col2:
|
651 |
st.markdown(get_download_link(file), unsafe_allow_html=True)
|
652 |
with col3:
|
653 |
-
if st.button("π", key=f"edit_{
|
654 |
st.session_state.current_file = file
|
655 |
st.session_state.file_content = load_file(file)
|
656 |
with col4:
|
657 |
-
if st.button("π", key=f"
|
658 |
os.remove(file)
|
659 |
st.rerun()
|
660 |
|
|
|
661 |
def main():
|
662 |
st.sidebar.markdown("### π²BikeAIπ Claude and GPT Multi-Agent Research AI")
|
663 |
|
|
|
622 |
# Here you could integrate with image generation API
|
623 |
st.write(f"Generated scene description for {bike_name}:")
|
624 |
st.write(prompt)
|
625 |
+
|
626 |
def display_file_manager():
|
627 |
+
"""Display file management sidebar with guaranteed unique button keys."""
|
628 |
st.sidebar.title("π File Management")
|
629 |
|
630 |
all_files = glob.glob("*.md")
|
631 |
all_files.sort(reverse=True)
|
632 |
|
633 |
+
if st.sidebar.button("π Delete All", key="delete_all_files_button"):
|
|
|
634 |
for file in all_files:
|
635 |
os.remove(file)
|
636 |
st.rerun()
|
637 |
|
638 |
+
if st.sidebar.button("β¬οΈ Download All", key="download_all_files_button"):
|
|
|
639 |
zip_file = create_zip_of_files(all_files)
|
640 |
st.sidebar.markdown(get_download_link(zip_file), unsafe_allow_html=True)
|
641 |
|
642 |
+
# Create unique keys using file attributes
|
643 |
+
for idx, file in enumerate(all_files):
|
644 |
+
# Get file stats for unique identification
|
645 |
+
file_stat = os.stat(file)
|
646 |
+
unique_id = f"{idx}_{file_stat.st_size}_{file_stat.st_mtime}"
|
647 |
+
|
648 |
col1, col2, col3, col4 = st.sidebar.columns([1,3,1,1])
|
649 |
with col1:
|
650 |
+
if st.button("π", key=f"view_{unique_id}"):
|
651 |
st.session_state.current_file = file
|
652 |
st.session_state.file_content = load_file(file)
|
653 |
with col2:
|
654 |
st.markdown(get_download_link(file), unsafe_allow_html=True)
|
655 |
with col3:
|
656 |
+
if st.button("π", key=f"edit_{unique_id}"):
|
657 |
st.session_state.current_file = file
|
658 |
st.session_state.file_content = load_file(file)
|
659 |
with col4:
|
660 |
+
if st.button("π", key=f"delete_{unique_id}"):
|
661 |
os.remove(file)
|
662 |
st.rerun()
|
663 |
|
664 |
+
|
665 |
def main():
|
666 |
st.sidebar.markdown("### π²BikeAIπ Claude and GPT Multi-Agent Research AI")
|
667 |
|