bgaspra commited on
Commit
dd78c52
·
verified ·
1 Parent(s): 9cb34ee

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -4
app.py CHANGED
@@ -8,14 +8,13 @@ from tensorflow.keras.preprocessing import image
8
  from sklearn.neighbors import NearestNeighbors
9
  import joblib
10
  from PIL import UnidentifiedImageError, Image
11
- import matplotlib.pyplot as plt
12
  import gradio as gr
13
 
14
  # Load the dataset
15
  dataset = load_dataset("thefcraft/civitai-stable-diffusion-337k")
16
 
17
  # Take a subset of the dataset
18
- subset_size = 100 # Reduce the subset size for faster execution in Spaces
19
  dataset_subset = dataset['train'].shuffle(seed=42).select(range(subset_size))
20
 
21
  # Directory to save images
@@ -107,8 +106,8 @@ def display_images(input_image):
107
 
108
  interface = gr.Interface(
109
  fn=display_images,
110
- inputs=gr.inputs.Image(type="pil"),
111
- outputs=gr.outputs.Carousel(label="Recommended Images", item_shape=(256, 256)),
112
  title="Image Recommendation System",
113
  description="Upload an image and get similar images with their model names and distances."
114
  )
 
8
  from sklearn.neighbors import NearestNeighbors
9
  import joblib
10
  from PIL import UnidentifiedImageError, Image
 
11
  import gradio as gr
12
 
13
  # Load the dataset
14
  dataset = load_dataset("thefcraft/civitai-stable-diffusion-337k")
15
 
16
  # Take a subset of the dataset
17
+ subset_size = 1000 # Reduce the subset size for faster execution in Spaces
18
  dataset_subset = dataset['train'].shuffle(seed=42).select(range(subset_size))
19
 
20
  # Directory to save images
 
106
 
107
  interface = gr.Interface(
108
  fn=display_images,
109
+ inputs=gr.Image(type="pil"),
110
+ outputs=gr.Carousel(label="Recommended Images", item_shape=(256, 256)),
111
  title="Image Recommendation System",
112
  description="Upload an image and get similar images with their model names and distances."
113
  )