Spaces:
Runtime error
Runtime error
samarthagarwal23
commited on
Commit
•
2f33609
1
Parent(s):
29f96f7
Update app.py
Browse files
app.py
CHANGED
@@ -35,17 +35,25 @@ def user_query_recommend(query, price_rng):
|
|
35 |
|
36 |
op=recommendations\
|
37 |
.groupby("name")\
|
38 |
-
.
|
39 |
.reset_index()\
|
40 |
-
|
41 |
|
42 |
op = pd.merge(op,
|
43 |
recommendations[['name', 'category', 'price', 'description','description_sent','sim']],
|
44 |
how="left",on=["name",'sim'])
|
45 |
|
46 |
-
op = op.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
47 |
|
48 |
-
return op.reset_index(drop=True).head(6)
|
49 |
|
50 |
interface = gr.Interface(
|
51 |
user_query_recommend,
|
|
|
35 |
|
36 |
op=recommendations\
|
37 |
.groupby("name")\
|
38 |
+
.sim.nlargest(3)\
|
39 |
.reset_index()\
|
40 |
+
[["name","sim"]]
|
41 |
|
42 |
op = pd.merge(op,
|
43 |
recommendations[['name', 'category', 'price', 'description','description_sent','sim']],
|
44 |
how="left",on=["name",'sim'])
|
45 |
|
46 |
+
op = op.loc[(op.price >= min_p) & (op.price <= max_p),
|
47 |
+
['name', 'category', 'price', 'description', 'description_sent','sim']].sort_values('sim',ascending=False)\
|
48 |
+
.groupby(['name', 'category', 'price', 'description'])\
|
49 |
+
.agg({"description_sent": lambda x: " ".join(x),
|
50 |
+
"sim":['max']})\
|
51 |
+
.reset_index()\
|
52 |
+
.set_axis(['name', 'category', 'price', 'description', 'description_sent','sim'],axis="columns")
|
53 |
+
|
54 |
+
#op = op.loc[(op.price >= min_p) & (op.price <= max_p), ['name', 'price', 'description_sent']]
|
55 |
|
56 |
+
return op[['name', 'price', 'description_sent']].reset_index(drop=True).head(6)
|
57 |
|
58 |
interface = gr.Interface(
|
59 |
user_query_recommend,
|