Spaces:
Runtime error
Runtime error
Commit
·
a6ae805
1
Parent(s):
cf44989
Update app.py
Browse files
app.py
CHANGED
@@ -27,6 +27,8 @@ def user_query_recommend(query, min_p, max_p):
|
|
27 |
recommendations = reviews.copy()
|
28 |
recommendations['sim'] = sim_scores.T
|
29 |
recommendations = recommendations.sort_values('sim', ascending=False)
|
|
|
|
|
30 |
recommendations = recommendations.loc[(recommendations.price >= min_p) &
|
31 |
(recommendations.price <= max_p),
|
32 |
['name', 'price', 'description']].head(10)
|
@@ -36,14 +38,15 @@ def user_query_recommend(query, min_p, max_p):
|
|
36 |
interface = gr.Interface(
|
37 |
user_query_recommend,
|
38 |
inputs=[gr.inputs.Textbox(lines=5),
|
39 |
-
gr.inputs.Slider(minimum=
|
40 |
-
gr.inputs.Slider(minimum=
|
41 |
outputs=gr.outputs.Dataframe(max_rows=3, overflow_row_behaviour="paginate", type="pandas", label="Recommendations"),
|
42 |
title = "Scotch Recommendation",
|
43 |
-
description = "Looking for scotch recommendations and have some flavours in mind?
|
44 |
examples=[["very sweet with lemons and oranges and marmalades", 10,40],
|
45 |
["smoky peaty earthy and spicy",50,100],
|
46 |
["salty and spicy with exotic fruits", 50,500],
|
|
|
47 |
],
|
48 |
theme="grass",
|
49 |
)
|
|
|
27 |
recommendations = reviews.copy()
|
28 |
recommendations['sim'] = sim_scores.T
|
29 |
recommendations = recommendations.sort_values('sim', ascending=False)
|
30 |
+
if max_p < min_p:
|
31 |
+
min_p = 0
|
32 |
recommendations = recommendations.loc[(recommendations.price >= min_p) &
|
33 |
(recommendations.price <= max_p),
|
34 |
['name', 'price', 'description']].head(10)
|
|
|
38 |
interface = gr.Interface(
|
39 |
user_query_recommend,
|
40 |
inputs=[gr.inputs.Textbox(lines=5),
|
41 |
+
gr.inputs.Slider(minimum=10, maximum=1000, default=30, label='Min Price'),
|
42 |
+
gr.inputs.Slider(minimum=30, maximum=1000, default=70, label='Max Price')],
|
43 |
outputs=gr.outputs.Dataframe(max_rows=3, overflow_row_behaviour="paginate", type="pandas", label="Recommendations"),
|
44 |
title = "Scotch Recommendation",
|
45 |
+
description = "Looking for scotch recommendations and have some flavours in mind? \nGet recommendations at a preferred price range using semantic search :) ",
|
46 |
examples=[["very sweet with lemons and oranges and marmalades", 10,40],
|
47 |
["smoky peaty earthy and spicy",50,100],
|
48 |
["salty and spicy with exotic fruits", 50,500],
|
49 |
+
["fragrant nose with chocolate, toffee, pudding and caramel", 100,500],
|
50 |
],
|
51 |
theme="grass",
|
52 |
)
|