Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -4,7 +4,7 @@ import logging, os, re, sys, threading
|
|
4 |
|
5 |
from datasets import load_dataset
|
6 |
from dotenv import load_dotenv, find_dotenv
|
7 |
-
from custom_utils import process_records, connect_to_database,
|
8 |
|
9 |
from pydantic import BaseModel
|
10 |
from typing import Optional
|
@@ -39,6 +39,7 @@ def invoke(openai_api_key, prompt, rag_option):
|
|
39 |
Include a reason as to why you've chosen your selection.
|
40 |
"""
|
41 |
|
|
|
42 |
print("111")
|
43 |
dataset = load_dataset("MongoDB/airbnb_embeddings", streaming=True, split="train")
|
44 |
#dataset = dataset.take(100)
|
@@ -61,7 +62,9 @@ def invoke(openai_api_key, prompt, rag_option):
|
|
61 |
print("666")
|
62 |
# Not available in free tier
|
63 |
#setup_vector_search_index(collection=collection)
|
|
|
64 |
|
|
|
65 |
print("777")
|
66 |
search_path = "address.country"
|
67 |
|
@@ -76,11 +79,11 @@ def invoke(openai_api_key, prompt, rag_option):
|
|
76 |
|
77 |
print("999")
|
78 |
additional_stages = [match_stage]
|
|
|
79 |
|
80 |
print("000")
|
81 |
-
result = handle_user_query(openai_api_key, query, db, collection, additional_stages)
|
82 |
-
|
83 |
-
return result
|
84 |
|
85 |
gr.close_all()
|
86 |
|
|
|
4 |
|
5 |
from datasets import load_dataset
|
6 |
from dotenv import load_dotenv, find_dotenv
|
7 |
+
from custom_utils import process_records, connect_to_database, handle_user_query
|
8 |
|
9 |
from pydantic import BaseModel
|
10 |
from typing import Optional
|
|
|
39 |
Include a reason as to why you've chosen your selection.
|
40 |
"""
|
41 |
|
42 |
+
"""
|
43 |
print("111")
|
44 |
dataset = load_dataset("MongoDB/airbnb_embeddings", streaming=True, split="train")
|
45 |
#dataset = dataset.take(100)
|
|
|
62 |
print("666")
|
63 |
# Not available in free tier
|
64 |
#setup_vector_search_index(collection=collection)
|
65 |
+
"""
|
66 |
|
67 |
+
"""
|
68 |
print("777")
|
69 |
search_path = "address.country"
|
70 |
|
|
|
79 |
|
80 |
print("999")
|
81 |
additional_stages = [match_stage]
|
82 |
+
"""
|
83 |
|
84 |
print("000")
|
85 |
+
#result = handle_user_query(openai_api_key, query, db, collection, additional_stages)
|
86 |
+
return handle_user_query(openai_api_key, query, db, collection)
|
|
|
87 |
|
88 |
gr.close_all()
|
89 |
|