Spaces:
Sleeping
Sleeping
Gnanashri Kota Venkatesh commited on
Move marken_index creation inside button handler
Browse files
tab5.py
CHANGED
|
@@ -63,14 +63,18 @@ def brand_renamer_tool():
|
|
| 63 |
index=0
|
| 64 |
)
|
| 65 |
|
| 66 |
-
marken_index = {erste_marke: "01"}
|
| 67 |
-
aktuelle_nummer = 2
|
| 68 |
-
for marke in sorted(marken_set):
|
| 69 |
-
if marke != erste_marke:
|
| 70 |
-
marken_index[marke] = f"{aktuelle_nummer:02d}"
|
| 71 |
-
aktuelle_nummer += 1
|
| 72 |
-
|
| 73 |
if st.button("Process Files and Generate Reports", type="primary"):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 74 |
with st.spinner("Processing files..."):
|
| 75 |
# Process and rename files
|
| 76 |
renamed_files, file_to_factorgroup = process_files(
|
|
|
|
| 63 |
index=0
|
| 64 |
)
|
| 65 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 66 |
if st.button("Process Files and Generate Reports", type="primary"):
|
| 67 |
+
# Re-analyze to ensure we have ALL brands before processing
|
| 68 |
+
marken_set, _, _ = analyze_files_by_filename(input_folder)
|
| 69 |
+
|
| 70 |
+
# CREATE marken_index HERE, inside the button handler with ALL found brands
|
| 71 |
+
marken_index = {erste_marke: "01"}
|
| 72 |
+
aktuelle_nummer = 2
|
| 73 |
+
for marke in sorted(marken_set):
|
| 74 |
+
if marke != erste_marke:
|
| 75 |
+
marken_index[marke] = f"{aktuelle_nummer:02d}"
|
| 76 |
+
aktuelle_nummer += 1
|
| 77 |
+
|
| 78 |
with st.spinner("Processing files..."):
|
| 79 |
# Process and rename files
|
| 80 |
renamed_files, file_to_factorgroup = process_files(
|