File size: 718 Bytes
f749a35
a079e4c
f749a35
 
 
 
 
c774d2a
f749a35
 
74b6d9e
f749a35
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
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()