dani2112's picture
fix oob
1fc5e1f
from renumics import spotlight
from renumics.spotlight.analysis.typing import DataIssue
import pandas as pd
import numpy as np
if __name__ == "__main__":
df = pd.read_json("sd_dataset.json")
data_issues = sorted(df["selection"].unique())
spotlight_data_issues = []
for issue in data_issues:
if issue == -1:
continue
issue_rows = np.where(df["selection"] == issue)[0].tolist()
new_issue = DataIssue(
severity="medium",
title=f"Best Images Cluster {issue}",
description=f"Best Images Cluster {issue}",
rows=issue_rows)
spotlight_data_issues.append(new_issue)
while True:
dtypes = {
"image": spotlight.Image,
"clip_image_embedding": spotlight.Embedding,
"clip_text_embedding": spotlight.Embedding,
}
view = spotlight.show(
df,
dtype=dtypes,
layout="spotlight-layout.json",
issues=spotlight_data_issues,
port=7860,
host="0.0.0.0",
allow_filebrowsing=False
)
view.close()