Vincent Claes commited on
Commit ·
611aebd
1
Parent(s): 8b6eec6
first minimal working version using gradio
Browse filesFiles changed (4)
- MakefileAdded+2
- app.pyAdded+34
- poetry.lock
- pyproject.toml+1
12deps: poetry export --without-hashes --format=requirements.txt > requirements.txt12345678910111213141516171819202122232425262728293031323334import os
import gradio as grimport weaviate
collection_name = "Chunk"
def predict(input_text): client = weaviate.Client( url=os.environ["WEAVIATE_URL"], auth_client_secret=weaviate.AuthApiKey(api_key=os.environ["WEAVIATE_API_KEY"]), additional_headers={ "X-OpenAI-Api-Key": os.environ["OPENAI_API_KEY"] } )
return ( client.query .get(class_name=collection_name, properties=["text"]) .with_near_text({"concepts": input_text}) .with_limit(1) .with_generate(single_prompt="{text}") .do() )
iface = gr.Interface( fn=predict, # the function to wrap inputs="text", # the input type outputs="text", # the output type)
if __name__ == "__main__": iface.launch()11 unmodified lines12131415161711 unmodified linesweaviate-client = "^3.24.1"pypdf = "^3.16.1"goldenverba = "^0.2.3"[build-system]11 unmodified lines1213141516171811 unmodified linesweaviate-client = "^3.24.1"pypdf = "^3.16.1"goldenverba = "^0.2.3"gradio = "^3.44.4"[build-system]
MakefileAdded+2
app.pyAdded+34
poetry.lock
pyproject.toml+1