File size: 616 Bytes
0c16a3a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import gradio as gr
from matcher.similarity import get_similar_images  # adjust if function name differs

def recommend(image_path):
    # Returns list of top similar image paths (or PIL.Image)
    results = get_similar_images(image_path)
    return results

demo = gr.Interface(
    fn=recommend,
    inputs=gr.Image(type="filepath", label="Upload a product image"),
    outputs=gr.Gallery(label="Similar Products").style(grid=[2], height="auto"),
    title="Visual Product Matcher",
    description="Upload a product image to see the top visually similar products."
)

if __name__ == "__main__":
    demo.launch()