Spaces:
Sleeping
Sleeping
Commit
·
ffecd16
1
Parent(s):
97acf89
Force Error
Browse files
app.py
CHANGED
|
@@ -1547,15 +1547,10 @@ def run_model(model_name):
|
|
| 1547 |
heatmap_data = heat_stat.T
|
| 1548 |
# heatmap_data = np.nan_to_num(heat_stat.T, nan=0.0, posinf=0.0, neginf=0.0)
|
| 1549 |
|
| 1550 |
-
|
| 1551 |
-
|
| 1552 |
-
|
| 1553 |
-
|
| 1554 |
-
heatmap_data = heatmap_data.astype(float)
|
| 1555 |
-
|
| 1556 |
-
if nan_mask.any():
|
| 1557 |
-
transparent_layer = np.zeros_like(heatmap_data)
|
| 1558 |
-
transparent_layer[~nan_mask] = np.nan
|
| 1559 |
|
| 1560 |
# Definir el color mapper
|
| 1561 |
if selected_feature in model_options:
|
|
@@ -1589,16 +1584,25 @@ def run_model(model_name):
|
|
| 1589 |
heatmap_fig.border_fill_color = "white"
|
| 1590 |
|
| 1591 |
# Dibujar la imagen del heatmap
|
| 1592 |
-
|
| 1593 |
-
|
| 1594 |
-
|
| 1595 |
-
|
| 1596 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1597 |
heatmap_fig.image(
|
| 1598 |
image=[transparent_layer],
|
| 1599 |
x=x_min, y=y_min,
|
| 1600 |
dw=x_max - x_min, dh=y_max - y_min,
|
| 1601 |
-
color_mapper=
|
| 1602 |
)
|
| 1603 |
|
| 1604 |
# Agregar la barra de color
|
|
@@ -1945,6 +1949,7 @@ def main():
|
|
| 1945 |
config_style()
|
| 1946 |
tabs = st.tabs(["Donut", "Idefics2", "Idefics2-patient", "Paligemma", "Llava"])
|
| 1947 |
with tabs[0]:
|
|
|
|
| 1948 |
st.markdown('<h2 class="sub-title">Donut 🤗</h2>', unsafe_allow_html=True)
|
| 1949 |
run_model("Donut")
|
| 1950 |
with tabs[1]:
|
|
|
|
| 1547 |
heatmap_data = heat_stat.T
|
| 1548 |
# heatmap_data = np.nan_to_num(heat_stat.T, nan=0.0, posinf=0.0, neginf=0.0)
|
| 1549 |
|
| 1550 |
+
nan_mask = np.isnan(heatmap_data)
|
| 1551 |
+
valid_min = np.nanmin(heatmap_data)
|
| 1552 |
+
heatmap_data = np.nan_to_num(heatmap_data, nan=valid_min, posinf=valid_min, neginf=valid_min)
|
| 1553 |
+
heatmap_data = heatmap_data.astype(float)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1554 |
|
| 1555 |
# Definir el color mapper
|
| 1556 |
if selected_feature in model_options:
|
|
|
|
| 1584 |
heatmap_fig.border_fill_color = "white"
|
| 1585 |
|
| 1586 |
# Dibujar la imagen del heatmap
|
| 1587 |
+
|
| 1588 |
+
heatmap_fig.image(
|
| 1589 |
+
image=[heatmap_data],
|
| 1590 |
+
x=x_min,
|
| 1591 |
+
y=y_min,
|
| 1592 |
+
dw=x_max - x_min,
|
| 1593 |
+
dh=y_max - y_min,
|
| 1594 |
+
color_mapper=color_mapper
|
| 1595 |
+
)
|
| 1596 |
+
|
| 1597 |
+
if reduction_method == "UMAP" and nan_mask.any():
|
| 1598 |
+
transparent_layer = np.full_like(heatmap_data, np.nan)
|
| 1599 |
+
transparent_layer[nan_mask] = np.nanmin(heatmap_data)
|
| 1600 |
+
transparent_mapper = LinearColorMapper(palette=["rgba(255,255,255,0)"], low=np.nanmin(heatmap_data), high=np.nanmax(heatmap_data))
|
| 1601 |
heatmap_fig.image(
|
| 1602 |
image=[transparent_layer],
|
| 1603 |
x=x_min, y=y_min,
|
| 1604 |
dw=x_max - x_min, dh=y_max - y_min,
|
| 1605 |
+
color_mapper=transparent_mapper
|
| 1606 |
)
|
| 1607 |
|
| 1608 |
# Agregar la barra de color
|
|
|
|
| 1949 |
config_style()
|
| 1950 |
tabs = st.tabs(["Donut", "Idefics2", "Idefics2-patient", "Paligemma", "Llava"])
|
| 1951 |
with tabs[0]:
|
| 1952 |
+
print(ahhas)
|
| 1953 |
st.markdown('<h2 class="sub-title">Donut 🤗</h2>', unsafe_allow_html=True)
|
| 1954 |
run_model("Donut")
|
| 1955 |
with tabs[1]:
|