Spaces:
Runtime error
Runtime error
Commit ·
818d7ad
1
Parent(s): 1ef3ac7
Update embeddings
Browse files- data/categories.bin +1 -1
- data/dishes.bin +1 -1
- data/restaurants.bin +2 -2
- scripts/create_embeddings.py +15 -6
data/categories.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 1134750
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d6521f92d3db3b7b34fb971dd902fe707470a5e07867d13737cb148ba597bd4b
|
| 3 |
size 1134750
|
data/dishes.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
size 7290051
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:765848ef3ced029b3c3178d5bd6d95fee83e26d119261940b3b3e76e97f26897
|
| 3 |
size 7290051
|
data/restaurants.bin
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:d3ca5f59f7088bd0cb369d3a33013b1a40dbcf269b6b62c0b43ed5ce87c60b1e
|
| 3 |
+
size 1858087
|
scripts/create_embeddings.py
CHANGED
|
@@ -99,13 +99,22 @@ def main():
|
|
| 99 |
cs = literal_eval(row['categories'])
|
| 100 |
|
| 101 |
location = get_district_name(row['map_latitude'], row['map_longitude'])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 102 |
|
| 103 |
text = f"""\
|
| 104 |
Name: {name}
|
| 105 |
-
Intro: {row['intro']}
|
| 106 |
-
Categories: {", ".join(cs)}
|
| 107 |
Dishes: {", ".join(ds)}
|
| 108 |
-
Location: {", ".join(location)}
|
|
|
|
| 109 |
"""
|
| 110 |
|
| 111 |
r = RestaurantDescription(
|
|
@@ -115,7 +124,7 @@ Location: {", ".join(location)}\
|
|
| 115 |
name=name,
|
| 116 |
name_alt=name_alt,
|
| 117 |
intro=row['intro'],
|
| 118 |
-
price=
|
| 119 |
rating=calculate_rating(row['score_cry'], row['score_o_k'], row['score_smile']),
|
| 120 |
categories=cs,
|
| 121 |
dishes=ds,
|
|
@@ -131,8 +140,8 @@ Location: {", ".join(location)}\
|
|
| 131 |
dish_list = DocList[Dish](dishes.values())
|
| 132 |
category_list = DocList[Category](categories.values())
|
| 133 |
|
| 134 |
-
|
| 135 |
-
|
| 136 |
|
| 137 |
embedding_settings = AzureOpenaiEmbeddings.load_from_env()
|
| 138 |
|
|
|
|
| 99 |
cs = literal_eval(row['categories'])
|
| 100 |
|
| 101 |
location = get_district_name(row['map_latitude'], row['map_longitude'])
|
| 102 |
+
price = int(row['price'])
|
| 103 |
+
if price < 100:
|
| 104 |
+
price_bucket = 'cheap'
|
| 105 |
+
elif 300 > price >= 100:
|
| 106 |
+
price_bucket = 'moderate'
|
| 107 |
+
elif price >= 300:
|
| 108 |
+
price_bucket = 'expensive'
|
| 109 |
+
|
| 110 |
+
extra_data = ' Romantic Dining.' if 'Romantic Dining' in cs else ""
|
| 111 |
|
| 112 |
text = f"""\
|
| 113 |
Name: {name}
|
| 114 |
+
Intro: {row['intro']}{extra_data}
|
|
|
|
| 115 |
Dishes: {", ".join(ds)}
|
| 116 |
+
Location: {", ".join(location)}
|
| 117 |
+
Price: {price_bucket}\
|
| 118 |
"""
|
| 119 |
|
| 120 |
r = RestaurantDescription(
|
|
|
|
| 124 |
name=name,
|
| 125 |
name_alt=name_alt,
|
| 126 |
intro=row['intro'],
|
| 127 |
+
price=price,
|
| 128 |
rating=calculate_rating(row['score_cry'], row['score_o_k'], row['score_smile']),
|
| 129 |
categories=cs,
|
| 130 |
dishes=ds,
|
|
|
|
| 140 |
dish_list = DocList[Dish](dishes.values())
|
| 141 |
category_list = DocList[Category](categories.values())
|
| 142 |
|
| 143 |
+
import IPython
|
| 144 |
+
IPython.embed()
|
| 145 |
|
| 146 |
embedding_settings = AzureOpenaiEmbeddings.load_from_env()
|
| 147 |
|