Update app.py
Browse files
app.py
CHANGED
@@ -17,12 +17,15 @@ if not os.path.exists(unzip_dir):
|
|
17 |
print("Extraction complete.")
|
18 |
|
19 |
# Step 2: Parse folders to dynamically populate dropdowns
|
|
|
|
|
|
|
20 |
activations = []
|
21 |
-
seeds_dict = dict()
|
22 |
-
neurons_dict = dict()
|
23 |
|
24 |
-
for act in os.listdir(
|
25 |
-
act_path = os.path.join(
|
26 |
if os.path.isdir(act_path) and not act.startswith("linear_models"):
|
27 |
activations.append(act)
|
28 |
seeds = []
|
@@ -40,6 +43,13 @@ for act in os.listdir(os.path.join(unzip_dir, 'Models')):
|
|
40 |
|
41 |
activations = sorted(activations)
|
42 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
43 |
# Step 3: Load linear models
|
44 |
# linear_rgb_path = os.path.join(unzip_dir, "linear_models/linear_rgb.joblib")
|
45 |
# linear_grey_path = os.path.join(unzip_dir, "linear_models/linear_grey.joblib")
|
|
|
17 |
print("Extraction complete.")
|
18 |
|
19 |
# Step 2: Parse folders to dynamically populate dropdowns
|
20 |
+
|
21 |
+
model_root = os.path.join(unzip_dir, 'Models') # Adjust this if your ZIP structure is different
|
22 |
+
|
23 |
activations = []
|
24 |
+
seeds_dict = dict()
|
25 |
+
neurons_dict = dict()
|
26 |
|
27 |
+
for act in os.listdir(model_root):
|
28 |
+
act_path = os.path.join(model_root, act)
|
29 |
if os.path.isdir(act_path) and not act.startswith("linear_models"):
|
30 |
activations.append(act)
|
31 |
seeds = []
|
|
|
43 |
|
44 |
activations = sorted(activations)
|
45 |
|
46 |
+
def update_seeds(activation):
|
47 |
+
return {"choices": seeds_dict[activation], "value": seeds_dict[activation][0]}
|
48 |
+
|
49 |
+
def update_neurons(activation, seed):
|
50 |
+
neurons = neurons_dict[(activation, seed)]
|
51 |
+
return {"choices": neurons, "value": neurons[0]}
|
52 |
+
|
53 |
# Step 3: Load linear models
|
54 |
# linear_rgb_path = os.path.join(unzip_dir, "linear_models/linear_rgb.joblib")
|
55 |
# linear_grey_path = os.path.join(unzip_dir, "linear_models/linear_grey.joblib")
|