Spaces:
Sleeping
Sleeping
Commit
·
5289fc1
1
Parent(s):
0838555
Fix Bug
Browse files
app.py
CHANGED
|
@@ -1448,6 +1448,14 @@ def run_model(model_name):
|
|
| 1448 |
df_real_only['TSNE1'] = reduced_real[:, 0]
|
| 1449 |
df_real_only['TSNE2'] = reduced_real[:, 1]
|
| 1450 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1451 |
unique_labels_real = sorted(df_real_only['label'].unique().tolist())
|
| 1452 |
|
| 1453 |
# Mapeo de colores para las muestras reales usando la paleta Reds9
|
|
@@ -1520,8 +1528,8 @@ def run_model(model_name):
|
|
| 1520 |
feature_options = [col for col in df_heat.columns if col != "name"]
|
| 1521 |
selected_feature = st.selectbox("Select heatmap feature:",
|
| 1522 |
options=feature_options, key=f"heatmap_{model_name}")
|
| 1523 |
-
select_extra_dataset_hm = st.selectbox("Select a dataset:",
|
| 1524 |
-
|
| 1525 |
|
| 1526 |
# Definir un rango fijo y rejilla
|
| 1527 |
x_min, x_max = -1, 1
|
|
@@ -1608,19 +1616,19 @@ def run_model(model_name):
|
|
| 1608 |
})
|
| 1609 |
invisible_renderer = heatmap_fig.circle('x', 'y', size=10, source=source_points, fill_alpha=0, line_alpha=0.5)
|
| 1610 |
|
| 1611 |
-
if select_extra_dataset_hm != "-":
|
| 1612 |
-
|
| 1613 |
-
|
| 1614 |
-
|
| 1615 |
-
|
| 1616 |
-
|
| 1617 |
-
|
| 1618 |
-
|
| 1619 |
-
|
| 1620 |
-
|
| 1621 |
-
|
| 1622 |
-
|
| 1623 |
-
|
| 1624 |
|
| 1625 |
hover_tool_points = HoverTool(renderers=[invisible_renderer], tooltips=TOOLTIPS)
|
| 1626 |
heatmap_fig.add_tools(hover_tool_points)
|
|
|
|
| 1448 |
df_real_only['TSNE1'] = reduced_real[:, 0]
|
| 1449 |
df_real_only['TSNE2'] = reduced_real[:, 1]
|
| 1450 |
|
| 1451 |
+
# Construir df_all de forma consistente con PCA
|
| 1452 |
+
df_all = {}
|
| 1453 |
+
df_all["real"] = df_real_only.copy()
|
| 1454 |
+
if "synthetic" in embeddings:
|
| 1455 |
+
df_all["synthetic"] = embeddings["synthetic"].copy()
|
| 1456 |
+
if "pretrained" in embeddings:
|
| 1457 |
+
df_all["pretrained"] = embeddings["pretrained"].copy()
|
| 1458 |
+
|
| 1459 |
unique_labels_real = sorted(df_real_only['label'].unique().tolist())
|
| 1460 |
|
| 1461 |
# Mapeo de colores para las muestras reales usando la paleta Reds9
|
|
|
|
| 1528 |
feature_options = [col for col in df_heat.columns if col != "name"]
|
| 1529 |
selected_feature = st.selectbox("Select heatmap feature:",
|
| 1530 |
options=feature_options, key=f"heatmap_{model_name}")
|
| 1531 |
+
# select_extra_dataset_hm = st.selectbox("Select a dataset:",
|
| 1532 |
+
# options=model_options_with_default, key=f"heatmap_extra_dataset_{model_name}")
|
| 1533 |
|
| 1534 |
# Definir un rango fijo y rejilla
|
| 1535 |
x_min, x_max = -1, 1
|
|
|
|
| 1616 |
})
|
| 1617 |
invisible_renderer = heatmap_fig.circle('x', 'y', size=10, source=source_points, fill_alpha=0, line_alpha=0.5)
|
| 1618 |
|
| 1619 |
+
# if select_extra_dataset_hm != "-":
|
| 1620 |
+
# df_extra = df_all["synthetic"][df_all["synthetic"]["source"] == select_extra_dataset_hm].copy()
|
| 1621 |
+
# df_extra["x"] = df_extra[x_comp]
|
| 1622 |
+
# df_extra["y"] = df_extra[y_comp]
|
| 1623 |
+
# if 'name' not in df_extra.columns:
|
| 1624 |
+
# df_extra["name"] = df_extra["img"].apply(lambda x: x.split("/")[-1].replace(".png", "") if isinstance(x, str) else x)
|
| 1625 |
+
# source_extra_points = ColumnDataSource(data={
|
| 1626 |
+
# 'x': df_extra['x'],
|
| 1627 |
+
# 'y': df_extra['y'],
|
| 1628 |
+
# 'img': df_extra['img'],
|
| 1629 |
+
# 'label': df_extra['name']
|
| 1630 |
+
# })
|
| 1631 |
+
# heatmap_fig.circle('x', 'y', size=5, source=source_extra_points, fill_alpha=0, line_alpha=0.5, color="purple")
|
| 1632 |
|
| 1633 |
hover_tool_points = HoverTool(renderers=[invisible_renderer], tooltips=TOOLTIPS)
|
| 1634 |
heatmap_fig.add_tools(hover_tool_points)
|