eybro commited on
Commit
3ee86f9
·
verified ·
1 Parent(s): f1a01f1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -10
app.py CHANGED
@@ -7,19 +7,11 @@ from keras.models import Model
7
  from datasets import load_dataset
8
  from sklearn.cluster import KMeans
9
  import matplotlib.pyplot as plt
10
- import pickle
11
 
12
  autoencoder = load_model("autoencoder_model.keras")
13
  encoded_images = np.load("X_encoded_compressed.npy")
14
 
15
-
16
- # dataset with the split index
17
- with open("dataset_with_split.pkl", "rb") as f:
18
- data = pickle.load(f)
19
-
20
- dataset = data['dataset']
21
- split = data['split']
22
-
23
 
24
  num_clusters = 10 # Choose the number of clusters
25
  kmeans = KMeans(n_clusters=num_clusters, random_state=42)
@@ -69,7 +61,7 @@ def inference(image):
69
  """"""
70
  # input_image = process_image(image)
71
 
72
- input_image = encoded_images[1010]
73
 
74
  nearest_neighbors = find_nearest_neighbors(encoded_images, input_image, top_n=5)
75
 
 
7
  from datasets import load_dataset
8
  from sklearn.cluster import KMeans
9
  import matplotlib.pyplot as plt
 
10
 
11
  autoencoder = load_model("autoencoder_model.keras")
12
  encoded_images = np.load("X_encoded_compressed.npy")
13
 
14
+ dataset = load_dataset("eybro/images-split")
 
 
 
 
 
 
 
15
 
16
  num_clusters = 10 # Choose the number of clusters
17
  kmeans = KMeans(n_clusters=num_clusters, random_state=42)
 
61
  """"""
62
  # input_image = process_image(image)
63
 
64
+ input_image = encoded_images[2000]
65
 
66
  nearest_neighbors = find_nearest_neighbors(encoded_images, input_image, top_n=5)
67