Download dataframe.py from osanchik/PicFinder: direct link, hf CLI and curl.
- Browser
- Download file 382 Bytes
-
https://huggingface.co/spaces/osanchik/PicFinder/resolve/main/dataframe.py
- Command line
-
hf download hf://spaces/osanchik/PicFinder/dataframe.py
-
curl -L -o dataframe.py https://huggingface.co/spaces/osanchik/PicFinder/resolve/main/dataframe.py
382 Bytes
| import pandas as pd | |
| import numpy as np | |
| def get_image_data(csv_file) : | |
| image_data_df = pd.read_csv (csv_file) | |
| image_data_df['text_embeddings'] = image_data_df['text_embeddings'].apply(lambda x: np.fromstring(x[2:-2], sep=' ')).values | |
| image_data_df['text_embeddings'] = image_data_df['text_embeddings'].apply(lambda x: np.reshape(x, (1, -1))) | |
| return image_data_df | |