Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -32,7 +32,7 @@ def configure_llama_model():
|
|
32 |
return llm
|
33 |
|
34 |
def configure_embeddings():
|
35 |
-
embed_model = HuggingFaceEmbeddings(model_name="
|
36 |
return embed_model
|
37 |
|
38 |
|
@@ -51,8 +51,9 @@ def initialize_vector_store_index(data_path, service_context):
|
|
51 |
index = pickle.load(f)
|
52 |
#index = VectorStoreIndex.from_documents(documents, service_context=service_context)
|
53 |
embeddings_2 = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|
54 |
-
|
55 |
-
|
|
|
56 |
|
57 |
def main():
|
58 |
st.title("Cloudflare RAG")
|
@@ -68,10 +69,10 @@ def main():
|
|
68 |
|
69 |
if user_input:
|
70 |
# Generate response
|
71 |
-
|
72 |
-
|
73 |
# Display response
|
74 |
-
st.text_area("ChatGPT Response:",
|
75 |
|
76 |
if __name__ == "__main__":
|
77 |
main()
|
|
|
32 |
return llm
|
33 |
|
34 |
def configure_embeddings():
|
35 |
+
embed_model = HuggingFaceEmbeddings(model_name="all-MiniLM-L6-v2")
|
36 |
return embed_model
|
37 |
|
38 |
|
|
|
51 |
index = pickle.load(f)
|
52 |
#index = VectorStoreIndex.from_documents(documents, service_context=service_context)
|
53 |
embeddings_2 = SentenceTransformerEmbeddings(model_name="all-MiniLM-L6-v2")
|
54 |
+
documents = SimpleDirectoryReader("/content/Data/").load_data()
|
55 |
+
index = VectorStoreIndex.from_documents(documents, service_context=service_context)
|
56 |
+
return index
|
57 |
|
58 |
def main():
|
59 |
st.title("Cloudflare RAG")
|
|
|
69 |
|
70 |
if user_input:
|
71 |
# Generate response
|
72 |
+
query_engine = index.as_query_engine()
|
73 |
+
response = query_engine.query(user_input)
|
74 |
# Display response
|
75 |
+
st.text_area("ChatGPT Response:", response, height=400)
|
76 |
|
77 |
if __name__ == "__main__":
|
78 |
main()
|