answear/wide-eyes-bundle

WideEyes 的 API 客户端。

安装次数: 11,871

依赖项: 0

建议者: 0

安全性: 0

星标: 1

关注者: 3

分支: 0

公开问题: 0

类型:symfony-bundle

2.0.0 2022-08-18 10:24 UTC

This package is auto-updated.

Last update: 2024-08-23 16:56:50 UTC


README

为 Symfony 集成的 Wide Eyes。
API 文档可以在此处找到:https://wideeyes.ai/

安装

  • 使用 Composer 安装
composer require answear/wide-eyes-bundle

Answear\WideEyesBundle\AnswearWideEyesBundle::class => ['all' => true],
应由 Symfony Flex 自动添加到您的 config/bundles.php 文件中。

设置

  • 提供所需配置数据:privateKey
# config/packages/answear_wide_eyes.yaml
answear_wide_eyes:
    publicKey: 'your_public_key'

配置将传递给 \Answear\WideEyesBundle\Service\ConfigProvider 类。

使用

相似推荐

对于相似推荐,请使用 SimilarClient 及其方法 getSimilar

use Answear\WideEyesBundle\Service\SimilarClient;

$similarResponse = $similarClient->getSimilar('uid', 'country');

您的参数是:uid - 产品唯一的 id,以及 country - 您询问产品的国家。结果您将获得 SimilarResponse,该响应包含 api 返回的相似 uids

通过图片搜索

使用 SearchByImageClient 进行图片搜索。

检测和特征

要检测图片上的产品并找到其特征,请使用 detectAndFeatures

use Answear\WideEyesBundle\Service\SearchByImageClient;

$detectAndFeturesResponse = $searchByImageClient->getSimilar('url');

您的参数是:url - 您想检测产品和特征的图片的 url。结果您将获得 DetectAndFeaturesResponse,其中包含 api 返回的所有检测结果。

通过特征搜索

要使用之前找到的特征搜索产品,请使用 searchByFeature

use Answear\WideEyesBundle\Service\SearchByImageClient;

$detectAndFeturesResponse = $searchByImageClient->searchByFeature('featureId', 'label', 'gender', 'filters', 'maxNumResults');

您的参数是

  • featureId - 从 DetectAndFeatures 获得的 featureId
  • label - 从 DetectAndFeatures 获得的 label
  • gender - 从 DetectAndFeatures 获得的性别(可选)
  • filters - 结果过滤器(可选)
  • maxNumResults - 返回产品的最大数量(可选)

结果您将获得 SearchByFeatureResponse,其中包含满足您标准的所有找到的产品 uids

注意事项

欢迎提交带有新功能、改进或错误修复的 pull request。Answear 团队将非常感激任何评论。