Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -125,9 +125,26 @@ This table encapsulates the essence of AI's transformative potential across crea
|
|
125 |
|
126 |
""")
|
127 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
128 |
|
129 |
# Load example files
|
130 |
-
def
|
131 |
example_files = [f for f in os.listdir() if f.endswith('.txt')]
|
132 |
selected_file = st.selectbox("๐ Select an example file:", example_files)
|
133 |
if st.button(f"๐ Load {selected_file}"):
|
|
|
125 |
|
126 |
""")
|
127 |
|
128 |
+
def load_example_files():
|
129 |
+
# Exclude specific files
|
130 |
+
excluded_files = {'freeze.txt', 'requirements.txt', 'packages.txt', 'pre-requirements.txt'}
|
131 |
+
|
132 |
+
# List all .txt files excluding the ones in excluded_files
|
133 |
+
example_files = [f for f in os.listdir() if f.endswith('.txt') and f not in excluded_files]
|
134 |
+
|
135 |
+
# Check if there are any files to select from
|
136 |
+
if example_files:
|
137 |
+
selected_file = st.selectbox("๐ Select an example file:", example_files)
|
138 |
+
if st.button(f"๐ Load {selected_file}"):
|
139 |
+
with open(selected_file, 'r', encoding="utf-8") as file:
|
140 |
+
return file.read()
|
141 |
+
else:
|
142 |
+
st.write("No suitable example files found.")
|
143 |
+
|
144 |
+
return None
|
145 |
|
146 |
# Load example files
|
147 |
+
def load_example_files_old():
|
148 |
example_files = [f for f in os.listdir() if f.endswith('.txt')]
|
149 |
selected_file = st.selectbox("๐ Select an example file:", example_files)
|
150 |
if st.button(f"๐ Load {selected_file}"):
|