Spaces:
Runtime error
Runtime error
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("report-data-environmental-noise.json") | |
data_issues = df["issue"].unique() | |
spotlight_data_issues = [] | |
data_issue_severity = [] | |
for issue in data_issues: | |
if issue == -1: | |
continue | |
issue_rows = np.where(df["issue"] == issue)[0].tolist() | |
issue_metric = df[df["issue"] == issue].iloc[0]["issue_metric"] | |
data_issue_severity.append(issue_metric) | |
new_issue = DataIssue( | |
severity="medium", | |
title=f"Issue {issue}: {issue_metric:.2f}", | |
description=f"Issue {issue}: {issue_metric:.2f}", | |
rows=issue_rows) | |
spotlight_data_issues.append(new_issue) | |
data_issue_order = np.argsort(data_issue_severity) | |
data_issue_order = data_issue_order[::-1] | |
while True: | |
dtypes = { | |
"audio": spotlight.Audio, | |
"sg_emb_audio": spotlight.Embedding, | |
} | |
view = spotlight.show( | |
df, | |
dtype=dtypes, | |
layout="spotlight-layout-environmental-noise.json", | |
issues=np.array(spotlight_data_issues)[data_issue_order].tolist(), | |
port=7860, | |
host="0.0.0.0", | |
allow_filebrowsing=False | |
) | |
view.close() | |