Upload csvjson.json

#1
by Paresh9033 - opened

import gradio as gr
import json
from PIL import Image

Load JSON images

with open("images.json") as f:
data = json.load(f)

Dummy similarity search (for example purpose)

def search_image(uploaded_image):
# In real setup, compute embeddings + compare with JSON
top_results = data[:5] # top 5 results (placeholder)
return [d["url"] for d in top_results]

Gradio Interface

demo = gr.Interface(
fn=search_image,
inputs=gr.Image(type="pil"),
outputs=gr.Gallery(label="Top Matching Images")
)

demo.launch()

import gradio as gr
import json
from PIL import Image

Load JSON images

with open("images.json") as f:
data = json.load(f)

Dummy similarity search (for example purpose)

def search_image(uploaded_image):
# In real setup, compute embeddings + compare with JSON
top_results = data[:5] # top 5 results (placeholder)
return [d["url"] for d in top_results]

Gradio Interface

demo = gr.Interface(
fn=search_image,
inputs=gr.Image(type="pil"),
outputs=gr.Gallery(label="Top Matching Images")
)

demo.launch()

Paresh9033 changed pull request status to merged

Sign up or log in to comment