# -*- coding: utf-8 -*- | |
""" | |
Created on Wed Mar 22 19:59:54 2023 | |
""" | |
import gradio as gr | |
from simiandb import Simiandb | |
from langchain.embeddings import HuggingFaceEmbeddings | |
model_name = "all-MiniLM-L6-v2" | |
hf = HuggingFaceEmbeddings(model_name=model_name) | |
documentdb = Simiandb("mystore", embedding_function=hf, mode="a") | |
def search(query): | |
return documentdb.similarity_search(query) | |
iface = gr.Interface(fn=search, inputs="text", outputs="text") | |
iface.launch() |