bstraehle commited on
Commit
c00fa6f
·
verified ·
1 Parent(s): 97960ab

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -24
app.py CHANGED
@@ -31,30 +31,12 @@ def invoke(openai_api_key, prompt, rag_option):
31
  os.environ["OPENAI_API_KEY"] = openai_api_key
32
 
33
  ###
34
- dataset = load_dataset("MongoDB/airbnb_embeddings", streaming=True, split="train")
35
- dataset = dataset.take(100)
36
- dataset_df = pd.DataFrame(dataset)
37
- dataset_df.head(5)
38
- print("Columns:", dataset_df.columns)
39
- records = dataset_df.to_dict(orient='records')
40
- # To handle catch `NaT` values
41
- for record in records:
42
- for key, value in record.items():
43
- # Check if the value is list-like; if so, process each element.
44
- if isinstance(value, list):
45
- processed_list = [None if pd.isnull(v) else v for v in value]
46
- record[key] = processed_list
47
- # For scalar values, continue as before.
48
- else:
49
- if pd.isnull(value):
50
- record[key] = None
51
- try:
52
- # Convert each dictionary to a Movie instance
53
- listings = [Listing(**record).dict() for record in records]
54
- # Get an overview of a single datapoint
55
- print(listings[0].keys())
56
- except ValidationError as e:
57
- print(e)
58
  ###
59
 
60
  """
 
31
  os.environ["OPENAI_API_KEY"] = openai_api_key
32
 
33
  ###
34
+ query = """
35
+ I want to stay in a place that's warm and friendly,
36
+ and not too far from resturants, can you recommend a place?
37
+ Include a reason as to why you've chosen your selection.
38
+ """
39
+ handle_user_query(query, db, collection)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
40
  ###
41
 
42
  """