Spaces:
Runtime error
Runtime error
Commit
•
c90ecbf
1
Parent(s):
9f55f25
Update app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
-
def generate_recommendations(party_on_weekends, flavor_preference, texture_dislike, price_range):
|
5 |
# Define the list of ingredients
|
6 |
ingredients = ["oranges", "apples", "pears", "grapes", "watermelon", "lemon", "lime"]
|
7 |
|
@@ -35,21 +35,22 @@ def generate_recommendations(party_on_weekends, flavor_preference, texture_disli
|
|
35 |
if "watermelon" in allowed_fruits:
|
36 |
allowed_fruits.remove("watermelon")
|
37 |
|
38 |
-
if price_range
|
39 |
-
if
|
40 |
-
|
41 |
-
|
42 |
-
|
|
|
43 |
|
44 |
-
|
45 |
-
|
46 |
-
|
47 |
-
|
48 |
-
|
49 |
|
50 |
return allowed_fruits
|
51 |
|
52 |
-
def recommend_fruits(party_answer, flavor_answer, texture_answer, price_answer):
|
53 |
# Combine the answers dynamically
|
54 |
combined_answers = {
|
55 |
"Do you go out to party on weekends? (yes or no)": party_answer,
|
|
|
1 |
from transformers import pipeline
|
2 |
import gradio as gr
|
3 |
|
4 |
+
def generate_recommendations(party_on_weekends=None, flavor_preference=None, texture_dislike=None, price_range=None):
|
5 |
# Define the list of ingredients
|
6 |
ingredients = ["oranges", "apples", "pears", "grapes", "watermelon", "lemon", "lime"]
|
7 |
|
|
|
35 |
if "watermelon" in allowed_fruits:
|
36 |
allowed_fruits.remove("watermelon")
|
37 |
|
38 |
+
if price_range is not None:
|
39 |
+
if price_range < 3:
|
40 |
+
if "lime" in allowed_fruits:
|
41 |
+
allowed_fruits.remove("lime")
|
42 |
+
if "watermelon" in allowed_fruits:
|
43 |
+
allowed_fruits.remove("watermelon")
|
44 |
|
45 |
+
elif 4 < price_range < 7:
|
46 |
+
if "pears" in allowed_fruits:
|
47 |
+
allowed_fruits.remove("pears")
|
48 |
+
if "apples" in allowed_fruits:
|
49 |
+
allowed_fruits.remove("apples")
|
50 |
|
51 |
return allowed_fruits
|
52 |
|
53 |
+
def recommend_fruits(party_answer="", flavor_answer="", texture_answer="", price_answer=None):
|
54 |
# Combine the answers dynamically
|
55 |
combined_answers = {
|
56 |
"Do you go out to party on weekends? (yes or no)": party_answer,
|