Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
|
@@ -91,14 +91,15 @@ Settings.embed_model = HuggingFaceEmbedding(model_name=EMBED_MODEL) # "sentence-
|
|
| 91 |
#)
|
| 92 |
vector_store = ChromaVectorStore(chroma_collection=collection)
|
| 93 |
index = VectorStoreIndex.from_vector_store(vector_store, embed_model=Settings.embed_model)
|
| 94 |
-
chat_engine = index.as_chat_engine(chat_mode="condense_question", verbose=True)
|
|
|
|
| 95 |
|
| 96 |
def upload_file(filepath):
|
| 97 |
documents = SimpleDirectoryReader(filepath).load_data()
|
| 98 |
index = VectorStoreIndex.from_documents(documents)
|
| 99 |
#query_engine = index.as_query_engine()
|
| 100 |
#condense_question condense_plus_context
|
| 101 |
-
|
| 102 |
return filepath
|
| 103 |
|
| 104 |
def resetChat():
|
|
@@ -172,8 +173,8 @@ def rag(input_text, history, jezik, file):
|
|
| 172 |
# if (o_jezik!='N/A'):
|
| 173 |
# input_text += " - odgovori " + o_jezik + "."
|
| 174 |
|
| 175 |
-
|
| 176 |
-
response = chat_engine.chat(input_text).response
|
| 177 |
return response
|
| 178 |
# Interface
|
| 179 |
# gr.Textbox(label="Pitanje:", lines=6),
|
|
|
|
| 91 |
#)
|
| 92 |
vector_store = ChromaVectorStore(chroma_collection=collection)
|
| 93 |
index = VectorStoreIndex.from_vector_store(vector_store, embed_model=Settings.embed_model)
|
| 94 |
+
#chat_engine = index.as_chat_engine(chat_mode="condense_question", verbose=True)
|
| 95 |
+
query_engine = index.as_query_engine(verbose=True)
|
| 96 |
|
| 97 |
def upload_file(filepath):
|
| 98 |
documents = SimpleDirectoryReader(filepath).load_data()
|
| 99 |
index = VectorStoreIndex.from_documents(documents)
|
| 100 |
#query_engine = index.as_query_engine()
|
| 101 |
#condense_question condense_plus_context
|
| 102 |
+
query_engine = index.as_query_engine(verbose=True)
|
| 103 |
return filepath
|
| 104 |
|
| 105 |
def resetChat():
|
|
|
|
| 173 |
# if (o_jezik!='N/A'):
|
| 174 |
# input_text += " - odgovori " + o_jezik + "."
|
| 175 |
|
| 176 |
+
response = query_engine.query(input_text)
|
| 177 |
+
# response = chat_engine.chat(input_text).response
|
| 178 |
return response
|
| 179 |
# Interface
|
| 180 |
# gr.Textbox(label="Pitanje:", lines=6),
|