gietema / clusterfun

Explore audio and images with one line of code. Python plotting library for data visualisation.
https://clusterfun.app
Apache License 2.0
43 stars 3 forks source link

Potential issue: Image cached based on base filename? #93

Open gietema opened 3 months ago

gietema commented 3 months ago

"For example file 1 is /full_image/uuid1.png, and file 2 is /cropped_face/uuid1.png"

Try to reproduce and fix.

gietema commented 3 months ago

Couldn't reproduce this with either

    df = pd.read_csv("https://raw.githubusercontent.com/gietema/clusterfun-data/main/wiki-art.csv")

    output_dir = Path(__file__).parent.parent / "data" / "imgs" / "sub"
    output_dir.mkdir(parents=True, exist_ok=True)

    with open(output_dir / "file.png", "wb") as file:
        file.write(requests.get(df.iloc[0].img_path).content)
    with open(output_dir.parent / "file.png", "wb") as file:
        file.write(requests.get(df.iloc[1].img_path).content)

    df = pd.DataFrame(df.iloc[:2])
    df["img_path"] = [str(output_dir / "file.png"), str(output_dir.parent / "file.png")]
    print(clt.scatter(df, x="x", y="y", media="img_path", show=True))

or

df = pd.read_csv("https://raw.githubusercontent.com/gietema/clusterfun-data/main/wiki-art.csv")
df = pd.DataFrame(df.iloc[:2])
df["img_path"] = [
      "https://clusterfun-test-bucket.s3.eu-west-2.amazonaws.com/sub/file.png",
      "https://clusterfun-test-bucket.s3.eu-west-2.amazonaws.com/file.png"
]
print(clt.scatter(df, x="x", y="y", media="img_path", show=True))