Update app.py
Browse files
app.py
CHANGED
@@ -16,7 +16,7 @@ import matplotlib.pyplot as plt
|
|
16 |
dataset = load_dataset("thefcraft/civitai-stable-diffusion-337k")
|
17 |
|
18 |
# Take a subset of the dataset
|
19 |
-
subset_size =
|
20 |
dataset_subset = dataset['train'].shuffle(seed=42).select(range(subset_size))
|
21 |
|
22 |
# Directory to save images
|
@@ -137,13 +137,14 @@ def display_images(image_paths, model_names, distances):
|
|
137 |
plt.axis('off')
|
138 |
plt.show()
|
139 |
|
140 |
-
# Gradio interface
|
141 |
interface = gr.Interface(
|
142 |
fn=recommend,
|
143 |
-
inputs=gr.
|
144 |
-
outputs=
|
145 |
title="Image Recommendation System",
|
146 |
description="Upload an image and get 5 recommended similar images with model names and distances."
|
147 |
)
|
148 |
|
|
|
|
|
149 |
interface.launch()
|
|
|
16 |
dataset = load_dataset("thefcraft/civitai-stable-diffusion-337k")
|
17 |
|
18 |
# Take a subset of the dataset
|
19 |
+
subset_size = 100
|
20 |
dataset_subset = dataset['train'].shuffle(seed=42).select(range(subset_size))
|
21 |
|
22 |
# Directory to save images
|
|
|
137 |
plt.axis('off')
|
138 |
plt.show()
|
139 |
|
|
|
140 |
interface = gr.Interface(
|
141 |
fn=recommend,
|
142 |
+
inputs=gr.Image(type="pil"), # Updated input component
|
143 |
+
outputs=gr.Text(), # Updated output component
|
144 |
title="Image Recommendation System",
|
145 |
description="Upload an image and get 5 recommended similar images with model names and distances."
|
146 |
)
|
147 |
|
148 |
+
interface.launch()
|
149 |
+
|
150 |
interface.launch()
|