Views
No views yet
1from transformers import pipeline
2from gift_finder_model import GiftFinderModel
3
4model = GiftFinderModel()
5
6# Example conversation
7conversation = """
8USER: I need to find a gift for my brother's birthday. He's in his 20s and loves playing basketball and video games. I don't want to spend more than $50.
9ASSISTANT: I'd be happy to help you find a birthday gift for your brother who loves basketball and video games within your $50 budget.
10"""
11
12result = model.process_conversation(conversation)
13print(result){
"extracted_data": {
"occasion": "birthday",
"recipient_relationship": "brother",
"recipient_age": "young adult",
"recipient_interests": "basketball and video games",
"budget": "moderate"
},
"gift_search_query": "birthday gift for brother who enjoys basketball and video games under $50"
}1from gift_finder_api import GiftFinderAPI
2
3# Initialize the API
4api = GiftFinderAPI()
5
6# Get recommendations with real product search
7recommendations = api.get_gift_recommendations(
8 conversation="...",
9 num_recommendations=5,
10 search_api_key="your_serpapi_key" # Pass your SerpAPI key here
11)
12
13# Display recommendations
14for rec in recommendations:
15 print(f"{rec['name']} - {rec['price']}")
16 print(f"{rec['description']}")
17 print(f"{rec['url']}")