Spaces:
Running
Running
Update pages/Entorno de Ejecución.py
Browse files
pages/Entorno de Ejecución.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
import streamlit as st
|
2 |
-
|
3 |
import streamlit as st
|
4 |
import tensorflow as tf
|
5 |
import numpy as np
|
@@ -46,6 +46,25 @@ for model in models:
|
|
46 |
model_dict[model_name] = model_dir
|
47 |
#model_list.append(os.path.join(DIR, model))
|
48 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
49 |
# Create a dropdown menu to select the model
|
50 |
model_choice = st.multiselect("Seleccione un modelo de clasificación", model_dict.keys())
|
51 |
|
|
|
1 |
import streamlit as st
|
2 |
+
import re
|
3 |
import streamlit as st
|
4 |
import tensorflow as tf
|
5 |
import numpy as np
|
|
|
46 |
model_dict[model_name] = model_dir
|
47 |
#model_list.append(os.path.join(DIR, model))
|
48 |
|
49 |
+
def extract_number(filename):
|
50 |
+
match = re.search(r'\d+', filename)
|
51 |
+
if match:
|
52 |
+
return int(match.group())
|
53 |
+
else:
|
54 |
+
return -1 # return -1 if there is no numeric value in the filename
|
55 |
+
|
56 |
+
def sort_key(filename):
|
57 |
+
parts = filename.split('.')
|
58 |
+
if len(parts) < 3:
|
59 |
+
return (parts[0], -1)
|
60 |
+
else:
|
61 |
+
return (parts[0], extract_number(parts[1]), parts[2])
|
62 |
+
|
63 |
+
# sort the filenames using the custom sorting key
|
64 |
+
sorted_keys = sorted(model_dict.keys(), key=sort_key)
|
65 |
+
|
66 |
+
model_dict = {k: model_dict[k] for k in sorted_keys}
|
67 |
+
|
68 |
# Create a dropdown menu to select the model
|
69 |
model_choice = st.multiselect("Seleccione un modelo de clasificación", model_dict.keys())
|
70 |
|