CLIP时尚推荐系统
基于CLIP的时尚推荐系统,允许用户上传服装图片,并根据视觉分析接收标签和推荐。
服务介绍
FastMCP_RecSys
这是一个基于CLIP的时尚推荐系统,使用了MCP。
文件夹结构
/project-root
│
├── /backend
│ ├── Dockerfile # Backend Dockerfile
│ ├── /app
│ │ ├── main.py # FastAPI app code
│ │ └── requirements.txt # Python dependencies for the backend
│ └── .env # Environment variables (make sure to add this to .gitignore)
│
├── /frontend
│ ├── Dockerfile # Frontend Dockerfile
│ ├── package.json # Node.js dependencies (for React)
│ ├── package-lock.json # Lock file for React dependencies
│ ├── /public
│ │ └── index.html # HTML file for the frontend (React app is mounted here)
│ ├── /src
│ │ ├── App.js # Main React component
│ │ └── index.js # React entry point
│ ├── tailwind.config.js # Tailwind CSS config
│ ├── postcss.config.js # PostCSS config
│ └── .env # Frontend environment variables (add to .gitignore)
│
├── .gitignore # Git ignore file (include .env, node_modules, etc.)
├── docker-compose.yml # Docker Compose configuration
└── README.md # Project documentation
步骤 1
更新Mongo服务以添加相同的凭证:
mongo:
image: mongo:latest
ports:
- "27017:27017"
environment:
MONGO_INITDB_ROOT_USERNAME: root
MONGO_INITDB_ROOT_PASSWORD: example
volumes:
- mongo-data:/data/db
注意:由于在FastAPI应用程序中使用环境变量,Mongo URL应如下所示:
MONGO_URL = "mongodb://root:example@mongo:27017"
一旦运行起来,请打开浏览器并访问 👉 http://localhost:8081
使用以下信息登录:用户名: root / 密码: example(临时设置)
步骤 2
docker-compose up --build
这将:
- 启动带有热重载功能的FastAPI后端
- 启动MongoDB
- 启动Mongo Express(用于数据库UI)(此模式下前端不会自动构建)
步骤 3
- 在 http://localhost:3000 访问前端(React应用)
- 在 http://localhost:8000 访问后端(FastAPI应用)
📌 快速提示
访问您的应用:http://localhost:8000/docs
查看MongoDB UI:http://localhost:8081 (使用用户: root, 密码: example)
mongo-seed 只在启动时运行一次来填充您的标签集合。
📌 UI 的示例组件
- 图像上传
- 提交按钮
- 显示服装标签 + 推荐