File size: 682 Bytes
680264e
7405ccb
7b240d9
a51ac58
5518038
680264e
5518038
 
 
 
 
7b240d9
5518038
3f7221a
5518038
7b240d9
5518038
7b240d9
 
 
 
a51ac58
5518038
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import gradio as gr
import json
from groq_helper import generate_chat_completion
from retrieval_helper import fetch
from groq import Groq

def generate_chat_completion_interface(USER_INPUT):

    top_documents = fetch(USER_INPUT)
    related_vectors = "\n".join(top_documents)

    result = generate_chat_completion(USER_INPUT, related_vectors)

    return result

# Gradio app interface
iface = gr.Interface(
    fn=generate_chat_completion_interface,
    inputs=gr.Textbox(label="Enter your query"),
    outputs=gr.Textbox(label="Generated JSON"),
    title="RAG based search",
    description="Provide your natural language searhc query"
)

# Launch the interface
iface.launch()