Deep-Learning-Tinder 项目教程
1、项目的目录结构及介绍
Deep-Learning-Tinder/
├── credentials.json.example
├── main.py
├── README.md
├── requirements.txt
└── tinder_token.py
credentials.json.example
: 配置文件示例,包含 Facebook 和 API 的相关信息。main.py
: 项目的启动文件,负责运行 Tinder 算法。README.md
: 项目说明文档,包含项目的基本信息和使用方法。requirements.txt
: 项目依赖文件,列出了运行项目所需的 Python 包。tinder_token.py
: 用于获取 Tinder 令牌的脚本。
2、项目的启动文件介绍
main.py
是项目的启动文件,负责运行 Tinder 算法。以下是 main.py
的基本结构和功能介绍:
# main.py
import os
import json
from tinder_token import get_tinder_token
# 读取配置文件
with open('credentials.json') as f:
config = json.load(f)
# 获取 Tinder 令牌
tinder_token = get_tinder_token(config['FB_EMAIL_ADDRESS'], config['FB_PASSWORD'])
# 连接到 Tinder 服务器
# 此处省略具体实现
# 运行 Tinder 算法
# 此处省略具体实现
import
语句导入了项目所需的模块。open('credentials.json')
读取配置文件。get_tinder_token
函数用于获取 Tinder 令牌。- 后续代码负责连接到 Tinder 服务器并运行 Tinder 算法。
3、项目的配置文件介绍
credentials.json.example
是配置文件示例,包含以下字段:
{
"FB_ID": "tim cook",
"FB_EMAIL_ADDRESS": "tim cook@apple.com",
"FB_PASSWORD": "i_love_apple",
"API_HOST": "http://localhost:5000/",
"MODEL_ID": "20160619-000820-19f6"
}
FB_ID
: Facebook 用户 ID。FB_EMAIL_ADDRESS
: Facebook 邮箱地址。FB_PASSWORD
: Facebook 密码。API_HOST
: NVIDIA Digits 服务器的 URL。MODEL_ID
: 训练模型的 ID。
使用时,需要将 credentials.json.example
重命名为 credentials.json
,并填写相应的信息。
mv credentials.json.example credentials.json
vim credentials.json
填写完毕后,即可运行项目。