Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -91,7 +91,7 @@ headers = {
|
|
91 |
"Content-Type": "application/json"
|
92 |
}
|
93 |
|
94 |
-
# 🚲BikeAI🏆 Custom CSS
|
95 |
st.markdown("""
|
96 |
<style>
|
97 |
.main {
|
@@ -132,7 +132,7 @@ st.markdown("""
|
|
132 |
""", unsafe_allow_html=True)
|
133 |
|
134 |
|
135 |
-
# Helper Functions
|
136 |
def generate_filename(prompt, file_type):
|
137 |
"""Generate a safe filename using the prompt and file type."""
|
138 |
central = pytz.timezone('US/Central')
|
@@ -144,15 +144,12 @@ def generate_filename(prompt, file_type):
|
|
144 |
|
145 |
|
146 |
|
147 |
-
# Function to create and save a file (and avoid the black hole of lost data 🕳)
|
148 |
def create_file(filename, prompt, response, should_save=True):
|
149 |
if not should_save:
|
150 |
return
|
151 |
with open(filename, 'w', encoding='utf-8') as file:
|
152 |
file.write(prompt + "\n\n" + response)
|
153 |
-
|
154 |
-
|
155 |
-
|
156 |
def create_and_save_file(content, file_type="md", prompt=None, is_image=False, should_save=True):
|
157 |
"""Create and save file with proper handling of different types."""
|
158 |
if not should_save:
|
@@ -165,6 +162,7 @@ def create_and_save_file(content, file_type="md", prompt=None, is_image=False, s
|
|
165 |
f.write(prompt + "\n\n" + content if prompt else content)
|
166 |
return filename
|
167 |
|
|
|
168 |
def get_download_link(file_path):
|
169 |
"""Create download link for file."""
|
170 |
with open(file_path, "rb") as file:
|
@@ -866,22 +864,6 @@ def get_media_html(media_path, media_type="video", width="100%"):
|
|
866 |
Your browser does not support the audio element.
|
867 |
</audio>
|
868 |
'''
|
869 |
-
|
870 |
-
|
871 |
-
def main_old():
|
872 |
-
|
873 |
-
# Main navigation
|
874 |
-
tab_main = st.radio("Choose Action:",
|
875 |
-
["💬 Chat", "📸 Media Gallery", "🔍 Search ArXiv", "📝 File Editor"],
|
876 |
-
horizontal=True)
|
877 |
-
|
878 |
-
# Always show file manager in sidebar
|
879 |
-
# display_file_manager()
|
880 |
-
|
881 |
-
#if __name__ == "__main__":
|
882 |
-
# main()
|
883 |
-
|
884 |
-
|
885 |
|
886 |
def main():
|
887 |
st.sidebar.markdown("### 🚲BikeAI🏆 Claude and GPT Multi-Agent Research AI")
|
@@ -1014,7 +996,6 @@ def main():
|
|
1014 |
st.success("File updated successfully!")
|
1015 |
|
1016 |
|
1017 |
-
|
1018 |
# Always show file manager in sidebar
|
1019 |
display_file_manager()
|
1020 |
|
|
|
91 |
"Content-Type": "application/json"
|
92 |
}
|
93 |
|
94 |
+
# 6. 🚲BikeAI🏆 Custom CSS
|
95 |
st.markdown("""
|
96 |
<style>
|
97 |
.main {
|
|
|
132 |
""", unsafe_allow_html=True)
|
133 |
|
134 |
|
135 |
+
# 7. Helper Functions
|
136 |
def generate_filename(prompt, file_type):
|
137 |
"""Generate a safe filename using the prompt and file type."""
|
138 |
central = pytz.timezone('US/Central')
|
|
|
144 |
|
145 |
|
146 |
|
147 |
+
# 8. Function to create and save a file (and avoid the black hole of lost data 🕳)
|
148 |
def create_file(filename, prompt, response, should_save=True):
|
149 |
if not should_save:
|
150 |
return
|
151 |
with open(filename, 'w', encoding='utf-8') as file:
|
152 |
file.write(prompt + "\n\n" + response)
|
|
|
|
|
|
|
153 |
def create_and_save_file(content, file_type="md", prompt=None, is_image=False, should_save=True):
|
154 |
"""Create and save file with proper handling of different types."""
|
155 |
if not should_save:
|
|
|
162 |
f.write(prompt + "\n\n" + content if prompt else content)
|
163 |
return filename
|
164 |
|
165 |
+
|
166 |
def get_download_link(file_path):
|
167 |
"""Create download link for file."""
|
168 |
with open(file_path, "rb") as file:
|
|
|
864 |
Your browser does not support the audio element.
|
865 |
</audio>
|
866 |
'''
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
867 |
|
868 |
def main():
|
869 |
st.sidebar.markdown("### 🚲BikeAI🏆 Claude and GPT Multi-Agent Research AI")
|
|
|
996 |
st.success("File updated successfully!")
|
997 |
|
998 |
|
|
|
999 |
# Always show file manager in sidebar
|
1000 |
display_file_manager()
|
1001 |
|