tdnathmlenthusiast's picture
core model uploaded
d0f45ac verified
raw
history blame contribute delete
No virus
2.42 kB
from transformers import pipeline
def generate_recommendations(party_on_weekends, flavor_preference, texture_dislike, price_range):
# Define the list of ingredients
ingredients = ["oranges", "apples", "pears", "grapes", "watermelon", "lemon", "lime"]
# Apply the rules based on user answers
allowed_fruits = ingredients.copy()
if party_on_weekends == "yes":
allowed_fruits = list(set(allowed_fruits) & set(["apples", "pears", "grapes", "watermelon"]))
if flavor_preference == "cider":
allowed_fruits = list(set(allowed_fruits) & set(["apples", "oranges", "lemon", "lime"]))
elif flavor_preference == "sweet":
allowed_fruits = list(set(allowed_fruits) & set(["watermelon", "oranges"]))
elif flavor_preference == "waterlike":
allowed_fruits = list(set(allowed_fruits) & set(["watermelon"]))
if "grapes" in allowed_fruits:
allowed_fruits.remove("watermelon")
if texture_dislike == "smooth":
if "pears" in allowed_fruits:
allowed_fruits.remove("pears")
elif texture_dislike == "slimy":
slimy_fruits = ["watermelon", "lime", "grapes"]
allowed_fruits = list(set(allowed_fruits) - set(slimy_fruits))
elif texture_dislike == "waterlike":
if "watermelon" in allowed_fruits:
allowed_fruits.remove("watermelon")
if price_range < 3:
if "lime" in allowed_fruits:
allowed_fruits.remove("lime")
if "watermelon" in allowed_fruits:
allowed_fruits.remove("watermelon")
elif 4 < price_range < 7:
if "pears" in allowed_fruits:
allowed_fruits.remove("pears")
if "apples" in allowed_fruits:
allowed_fruits.remove("apples")
return allowed_fruits
def main():
# Take user input for each question
party_answer = input("Do you go out to party on weekends? (yes or no): ").lower()
flavor_answer = input("What flavors do you like? (cider, sweet, waterlike): ").lower()
texture_answer = input("What texture do you dislike? (smooth, slimy, waterlike): ").lower()
price_answer = int(input("What price range will you buy a drink for? ($1-$10): "))
# Call the function with user inputs
recommendations = generate_recommendations(party_answer, flavor_answer, texture_answer, price_answer)
print("Recommended fruits:", recommendations)
if __name__ == "__main__":
main()