Spaces:
Runtime error
Runtime error
Commit
·
c5e63e3
1
Parent(s):
b95b101
Update app.py
Browse files
app.py
CHANGED
@@ -26,12 +26,12 @@ def user_query_recommend(query, price_rng):
|
|
26 |
# Recommend
|
27 |
recommendations = reviews.copy()
|
28 |
recommendations['sim'] = sim_scores.T
|
29 |
-
if price_rng == "$0-$
|
30 |
-
min_p, max_p = 0,
|
31 |
-
if price_rng == "$
|
32 |
-
min_p, max_p =
|
33 |
-
if price_rng == "$
|
34 |
-
min_p, max_p =
|
35 |
|
36 |
op=recommendations\
|
37 |
.groupby("name")\
|
@@ -45,13 +45,13 @@ def user_query_recommend(query, price_rng):
|
|
45 |
|
46 |
op = op.sort_values('sim',ascending=False).loc[(op.price >= min_p) & (op.price <= max_p), ['name', 'price', 'description_sent']]
|
47 |
|
48 |
-
return op.reset_index(drop=True).head(
|
49 |
|
50 |
interface = gr.Interface(
|
51 |
user_query_recommend,
|
52 |
inputs=[gr.inputs.Textbox(lines=5, label = "enter flavour profile"),
|
53 |
gr.inputs.Radio(choices = ["$0-$50", "$50-$100", "$100+"], default="$0-$50", type="value", label='Price range')],
|
54 |
-
outputs=gr.outputs.Dataframe(max_rows=
|
55 |
title = "Scotch Recommendation",
|
56 |
description = "Looking for scotch recommendations and have some flavours in mind? \nGet recommendations at a preferred price range using semantic search :) ",
|
57 |
examples=[["very sweet with lemons and oranges and marmalades", "$0-$50"],
|
|
|
26 |
# Recommend
|
27 |
recommendations = reviews.copy()
|
28 |
recommendations['sim'] = sim_scores.T
|
29 |
+
if price_rng == "$0-$70":
|
30 |
+
min_p, max_p = 0, 70
|
31 |
+
if price_rng == "$70-$150":
|
32 |
+
min_p, max_p = 70, 150
|
33 |
+
if price_rng == "$150+":
|
34 |
+
min_p, max_p = 150, 10000
|
35 |
|
36 |
op=recommendations\
|
37 |
.groupby("name")\
|
|
|
45 |
|
46 |
op = op.sort_values('sim',ascending=False).loc[(op.price >= min_p) & (op.price <= max_p), ['name', 'price', 'description_sent']]
|
47 |
|
48 |
+
return op.reset_index(drop=True).head(6)
|
49 |
|
50 |
interface = gr.Interface(
|
51 |
user_query_recommend,
|
52 |
inputs=[gr.inputs.Textbox(lines=5, label = "enter flavour profile"),
|
53 |
gr.inputs.Radio(choices = ["$0-$50", "$50-$100", "$100+"], default="$0-$50", type="value", label='Price range')],
|
54 |
+
outputs=gr.outputs.Dataframe(max_rows=3, overflow_row_behaviour="paginate", type="pandas", label="Scotch recommendations"),
|
55 |
title = "Scotch Recommendation",
|
56 |
description = "Looking for scotch recommendations and have some flavours in mind? \nGet recommendations at a preferred price range using semantic search :) ",
|
57 |
examples=[["very sweet with lemons and oranges and marmalades", "$0-$50"],
|