Download monetization/affiliate_engine.py from mgbam/robosage: direct link, hf CLI and curl.
- Browser
- Download file 1.35 kB
-
https://huggingface.co/spaces/mgbam/robosage/resolve/f6b05dc604c3dc8c59a50df72963d1adf238e9a7/monetization/affiliate_engine.py
- Command line
-
hf download hf://spaces/mgbam/robosage@f6b05dc604c3dc8c59a50df72963d1adf238e9a7/monetization/affiliate_engine.py
-
curl -L -o affiliate_engine.py https://huggingface.co/spaces/mgbam/robosage/resolve/f6b05dc604c3dc8c59a50df72963d1adf238e9a7/monetization/affiliate_engine.py
1.35 kB
| # affiliate_engine.py - Recommends monetizable robot gear and affiliate links | |
| import random | |
| # Static affiliate product catalog by robot app category | |
| AFFILIATE_CATALOG = { | |
| "educational": [ | |
| {"name": "Raspberry Pi 4 Kit", "url": "https://amzn.to/3EduBot"}, | |
| {"name": "Qobo Coding Robot", "url": "https://amzn.to/3KidsCode"} | |
| ], | |
| "assistive": [ | |
| {"name": "Smart Sensor Kit", "url": "https://amzn.to/3AssistX"}, | |
| {"name": "OrCam MyEye Pro", "url": "https://amzn.to/OrCamEye"} | |
| ], | |
| "retail": [ | |
| {"name": "Motion Detection Greeter Bot", "url": "https://amzn.to/RetailWave"}, | |
| {"name": "Pepper Robot", "url": "https://amzn.to/3RetailAI"} | |
| ], | |
| "home automation": [ | |
| {"name": "Google Nest Hub", "url": "https://amzn.to/NestBot"}, | |
| {"name": "Arduino Smart Home Kit", "url": "https://amzn.to/ArduHome"} | |
| ], | |
| "creative": [ | |
| {"name": "AI Art Robot Arm", "url": "https://amzn.to/CreativeArm"}, | |
| {"name": "Doodlebot Kit", "url": "https://amzn.to/DoodleAI"} | |
| ] | |
| } | |
| def get_affiliate_recommendations(intent_category: str) -> list: | |
| items = AFFILIATE_CATALOG.get(intent_category, AFFILIATE_CATALOG["creative"]) | |
| return random.sample(items, k=min(2, len(items))) | |
| # Example usage | |
| if __name__ == "__main__": | |
| print(get_affiliate_recommendations("educational")) | |