Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
from datasets import load_dataset, DownloadConfig
|
| 3 |
-
|
| 4 |
import random
|
| 5 |
import numpy as np
|
| 6 |
from transformers import CLIPProcessor, CLIPModel
|
|
@@ -80,8 +80,10 @@ emb_filename = hf_hub_download(
|
|
| 80 |
filename="unsplash-25k-photos-embeddings-indexes.pkl",
|
| 81 |
repo_type="space"
|
| 82 |
)
|
| 83 |
-
with
|
| 84 |
-
|
|
|
|
|
|
|
| 85 |
|
| 86 |
|
| 87 |
height = 256 # height for resizing images
|
|
|
|
| 1 |
import gradio as gr
|
| 2 |
from datasets import load_dataset, DownloadConfig
|
| 3 |
+
import warnings
|
| 4 |
import random
|
| 5 |
import numpy as np
|
| 6 |
from transformers import CLIPProcessor, CLIPModel
|
|
|
|
| 80 |
filename="unsplash-25k-photos-embeddings-indexes.pkl",
|
| 81 |
repo_type="space"
|
| 82 |
)
|
| 83 |
+
with warnings.catch_warnings():
|
| 84 |
+
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
| 85 |
+
with open(emb_filename, 'rb') as emb:
|
| 86 |
+
id2url, img_names, img_emb = pickle.load(emb)
|
| 87 |
|
| 88 |
|
| 89 |
height = 256 # height for resizing images
|