| 论坛即将给大家带来全新的技术服务,面向三围图形学、游戏、动画的全新服务 | 论坛升级为UTF8版本后,中文用户名和用户密码中有中文的都无法登陆,请发邮件到324007255(at)QQ.com联系手动修改密码 | 3D技术论坛将以计算机图形学为核心,面向教育 推出国内的三维教育引擎该项目在持续研发当中,感谢大家的关注。 |
{ "genre": ["action", "fantasy"], "theme": ["dark fantasy", "post-apocalyptic"], "age_range": "shonen" } The response will be a JSON object containing anime and manga recommendations:
if __name__ == "__main__": app.run(debug=True)
# Sample anime and manga data anime_data = [ {"title": "Attack on Titan", "genre": ["action", "fantasy"], "theme": ["dark fantasy", "post-apocalyptic"]}, {"title": "Naruto", "genre": ["action", "adventure"], "theme": ["ninja life", "friendship"]}, {"title": "One Piece", "genre": ["action", "adventure"], "theme": ["pirate life", "friendship"]}, # ... ]
# Recommendation function def get_recommendations(user_input): genre = user_input.get("genre") theme = user_input.get("theme") age_range = user_input.get("age_range")
for anime in anime_data: if genre and theme: if set(genre).intersection(anime["genre"]) and set(theme).intersection(anime["theme"]): anime_recommendations.append(anime["title"]) elif genre: if set(genre).intersection(anime["genre"]): anime_recommendations.append(anime["title"]) elif theme: if set(theme).intersection(anime["theme"]): anime_recommendations.append(anime["title"])
from flask import Flask, request, jsonify from flask_cors import CORS
Here's a sample implementation using Python and the Flask web framework:
手机版|小黑屋|3D数字艺术论坛 ( 沪ICP备14023054号 )
GMT+8, 2026-3-9 07:34
Powered by Discuz! X3.4
Copyright © 2001-2020, Tencent Cloud.