adityaaarora's picture
Add gradio
0c16a3a
raw
history blame contribute delete
616 Bytes
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()