Spaces:
Sleeping
Sleeping
import gradio as gr | |
from search_ocean import search_text, search_image | |
def multimodal_search(query, image): | |
results = [] | |
if query: | |
text_results = search_text(query) | |
results += [f"📝 Text result:\n{str(r['content']['content'])[:512]}" for r in text_results] | |
if image: | |
image_results = search_image(image) | |
results += [f"🖼️ Image result:\n{str(r['content'])}" for r in image_results] | |
return "\n\n".join(results) | |
gr.Interface( | |
fn=multimodal_search, | |
inputs=[ | |
gr.Textbox(label="Text Query"), | |
gr.Image(type="pil", label="Image Query") | |
], | |
outputs=gr.Textbox(label="Top Results"), | |
title="Multimodal RAG with Ocean and CLIP", | |
).launch() |