Spaces:
Sleeping
Sleeping
Commit
·
3145d7c
1
Parent(s):
7356f5c
Vector and query engine
Browse files
app.py
CHANGED
@@ -10,9 +10,11 @@ openai.api_key = os.environ['OpenAI_ApiKey']
|
|
10 |
Settings.embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-small-en-v1.5")
|
11 |
|
12 |
documents = SimpleDirectoryReader("data").load_data()
|
|
|
|
|
13 |
|
14 |
-
def greet(
|
15 |
-
return
|
16 |
|
17 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
18 |
demo.launch()
|
|
|
10 |
Settings.embed_model = HuggingFaceEmbedding(model_name="BAAI/bge-small-en-v1.5")
|
11 |
|
12 |
documents = SimpleDirectoryReader("data").load_data()
|
13 |
+
index = VectorStoreIndex.from_documents(documents)
|
14 |
+
query_engine = index.as_query_engine()
|
15 |
|
16 |
+
def greet(question):
|
17 |
+
return query_engine.query(question)
|
18 |
|
19 |
demo = gr.Interface(fn=greet, inputs="text", outputs="text")
|
20 |
demo.launch()
|