datadabllp

generate personalized category names

Jul 19th, 2024
458
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.00 KB | None | 0 0
  1. def generate_personalized_categories(user_data):
  2.     prompt = f"""
  3.    Generate 5 personalized streaming category names and descriptions for a user with the following viewing history and preferences:
  4.    
  5.    Recently watched: {', '.join(user_data['recently_watched'])}
  6.    Favorite genres: {', '.join(user_data['favorite_genres'])}
  7.    Mood: {user_data['current_mood']}
  8.  
  9.    For each category, provide:
  10.    1. A catchy, personalized category name
  11.    2. A brief, engaging description of the category
  12.    
  13.    Ensure the categories and descriptions are tailored to the user's tastes and current mood.
  14.    """
  15.    
  16.     response = llm.generate(prompt)
  17.     return response.text
  18.  
  19. # Example usage
  20. user = {
  21.     "recently_watched": ["Stranger Things", "The Crown", "Black Mirror"],
  22.     "favorite_genres": ["sci-fi", "drama", "thriller"],
  23.     "current_mood": "looking for something thought-provoking"
  24. }
  25.  
  26. personalized_categories = generate_personalized_categories(user)
  27. print(personalized_categories)
  28.  
Advertisement
Add Comment
Please, Sign In to add comment