Spaces:
Sleeping
Sleeping
File size: 626 Bytes
dace6eb 2e1aa7a |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
import gradio as gr
import functions as fn
import json
data = fn.load_embeddings()
num_documents = data['num_documents']
num_segment_contents = data['num_segment_contents']
with open("gradio.json", encoding='utf-8') as f:
config = json.load(f)
config['description'] = config['description'].format(num_documents=num_documents, num_segment_contents=num_segment_contents)
def on_submit(query, history):
response = fn.rag_response(query, data=data, detailed_response=False)
return gr.HTML(response.replace("\n", "<br>"))
demo = gr.ChatInterface(fn=on_submit, cache_examples= False, **config)
demo.launch() |