Commit c00857cf authored by 张伟男's avatar 张伟男

AI

parent 598b8641
......@@ -57,9 +57,15 @@ class gmai_request(BaseRequest):
self.params["version"] = version
return self.api_send(self.data["plastic_cheek_style_classify"])
# 验证用户之前是否使用过测肤质,绑定用户
def skin_user_had_test(self,device_id):
self.params["device_id"] = device_id
return self.api_send(self.data["skin_user_had_test"])
if __name__ == '__main__':
print(gmai_request().plastic_cheek_style_classify("7.44.0"))
print(gmai_request().skin_user_had_test("androidid_7255c3398845cdd5"))
# print(gmai_request().plastic_cheek_style_classify("7.44.0"))
# landmark = '[{"x":168.96603,"y":496.76886},{"x":168.35735,"y":527.7101},{"x":169.548,"y":558.3961},{"x":171.72018,"y":588.8369},{"x":174.93307,"y":619.26794},{"x":179.31195,"y":649.03467},{"x":184.17123,"y":678.6978},{"x":191.05627,"y":707.8003},{"x":200.86497,"y":735.76196},{"x":214.62796,"y":761.79736},{"x":231.40042,"y":785.7622},{"x":250.59685,"y":807.22406},{"x":272.07196,"y":826.8049},{"x":295.4251,"y":843.86194},{"x":321.47278,"y":856.83124},{"x":349.9967,"y":864.5885},{"x":379.85767,"y":866.998},{"x":409.25287,"y":865.863},{"x":437.7829,"y":859.18054},{"x":463.35132,"y":846.88574},{"x":486.354,"y":830.38916},{"x":507.7304,"y":811.95135},{"x":527.778,"y":791.59247},{"x":545.7143,"y":769.32104},{"x":561.4353,"y":745.4949},{"x":573.70917,"y":719.9794},{"x":583.3716,"y":690.47156},{"x":591.3898,"y":660.6565},{"x":598.52515,"y":631.38513},{"x":604.5137,"y":601.75684},{"x":609.14844,"y":572.0621},{"x":612.0713,"y":541.85956},{"x":613.5779,"y":511.5329},{"x":203.42625,"y":444.83066},{"x":229.21182,"y":410.30188},{"x":270.9198,"y":399.64984},{"x":313.56497,"y":407.32513},{"x":354.0185,"y":422.54175},{"x":441.31384,"y":427.71216},{"x":482.0569,"y":416.21152},{"x":524.1508,"y":412.38593},{"x":563.6658,"y":426.22824},{"x":585.87964,"y":462.41913},{"x":394.46844,"y":504.41254},{"x":393.96762,"y":546.5007},{"x":393.30322,"y":588.8532},{"x":392.592,"y":631.0979},{"x":342.77267,"y":664.1739},{"x":364.95947,"y":668.7595},{"x":390.1893,"y":673.2006},{"x":415.25336,"y":670.5106},{"x":436.7552,"y":666.998},{"x":242.81853,"y":506.60803},{"x":262.98138,"y":497.55713},{"x":305.08954,"y":499.77777},{"x":321.22906,"y":513.3391},{"x":301.56146,"y":521.4862},{"x":260.00668,"y":519.3686},{"x":462.97388,"y":517.84485},{"x":480.18396,"y":505.8437},{"x":522.09973,"y":506.45386},{"x":540.26013,"y":517.4052},{"x":523.0011,"y":528.3126},{"x":482.06146,"y":527.1489},{"x":239.75659,"y":436.6534},{"x":277.67075,"y":433.85788},{"x":315.04602,"y":438.8376},{"x":351.56638,"y":447.66888},{"x":441.58453,"y":452.58017},{"x":477.96664,"y":447.28973},{"x":515.05225,"y":445.83618},{"x":551.5746,"y":451.62656},{"x":284.38373,"y":496.0074},{"x":280.49805,"y":523.8891},{"x":284.44955,"y":508.43988},{"x":501.19617,"y":503.6411},{"x":502.51047,"y":530.9885},{"x":501.47836,"y":515.5879},{"x":357.51913,"y":508.84628},{"x":428.91504,"y":511.1767},{"x":341.02893,"y":607.7458},{"x":442.021,"y":610.8187},{"x":324.796,"y":641.13324},{"x":456.35925,"y":645.5844},{"x":304.6747,"y":728.90186},{"x":334.5838,"y":715.599},{"x":369.0162,"y":710.4512},{"x":390.31683,"y":714.9321},{"x":411.64032,"y":711.3696},{"x":445.83594,"y":718.7887},{"x":474.80075,"y":735.1745},{"x":451.05292,"y":753.0734},{"x":421.3767,"y":761.7219},{"x":390.41638,"y":763.2075},{"x":358.4326,"y":759.44385},{"x":328.53287,"y":748.5295},{"x":311.38818,"y":729.83777},{"x":350.23193,"y":734.1919},{"x":390.38123,"y":737.72284},{"x":429.7071,"y":736.18054},{"x":468.49692,"y":735.4535},{"x":430.71494,"y":739.61053},{"x":391.11005,"y":741.01697},{"x":349.98578,"y":737.08875},{"x":284.5382,"y":508.54742},{"x":501.50644,"y":515.53107}]'
# print(gmai_request().plastic_analystic_v2("869412032478155", "2021/06/01/1524/8a28dd0a3b8e",landmark,1))
# print(gmai_request().simulate_conf("-1"))
......
......@@ -64,3 +64,11 @@ plastic_cheek_style_classify:
url: /gm_ai/plastic/cheek_style_classify
params:
version: ${version}
skin_user_had_test:
method: get
url: /gm_ai/skin/user_had_test
params:
device_id: ${device_id}
isLogin: 1
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class scan_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.SCAN_DIARY_CARDS_CONFIG)
# 测颜值底部feed流
def scan_diary_cards(self, current_city_id, page,count, feature_results, feed_type):
self.params["current_city_id"] = current_city_id
self.params["page"] = page
self.params["count"] = count
self.params["feature_results"] = feature_results
self.params["feed_type"] = feed_type
return self.api_send(self.data["scan_diary_cards"])
if __name__ == '__main__':
print(scan_request().scan_diary_cards("beijing",1,10,'["细凤眼","眼距过宽","双眼皮","一字眉","流畅","厚唇","宽鼻翼","重度眼袋","尖下巴","无法令纹","娃娃脸",""]',1))
scan_diary_cards:
method: get
url: /api/scan/diary_cards
params:
current_city_id: ${current_city_id}
page: ${page}
count: ${count}
feature_results: ${feature_results}
feed_type: ${feed_type}
\ No newline at end of file
import path_setting
from in_common.base_request import BaseRequest
class skin_request(BaseRequest):
def __init__(self):
self.data = self.api_load(path_setting.SKIN_RECOMMEND_SERVICE_CONFIG)
# 测肤质底部feed流
def skin_recommend_service(self, device_id, current_city_id, appeal_tag_ids, offset, size):
self.params["current_city_id"] = current_city_id
self.params["appeal_tag_ids"] = appeal_tag_ids
self.params["offset"] = offset
self.params["size"] = size
self.params["device_id"] = device_id
return self.api_send(self.data["skin_recommend_service"])
if __name__ == '__main__':
print(skin_request().skin_recommend_service("androidid_7255c3398845cdd5", "beijing", '[2306,2303,2551,2355,2322,2337]', 0, 10))
skin_recommend_service:
method: get
url: /api/skin/recommend_service
params:
current_city_id: ${current_city_id}
offset: ${offset}
size: ${size}
appeal_tag_ids: ${appeal_tag_ids}
device_id: ${device_id}
\ No newline at end of file
......@@ -162,11 +162,20 @@ XCX_GENGMEI_GET_WXACODE_UNLIMITED_DATA = os.path.join(BASE_DIR, "backend_auto/te
# 测颜值根据标签召回日记
FACE_DIARY_CARDS_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "face_request.yaml")
FACE_DIARY_CARDS_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/face_data", "diary_cards.yaml")
# 测颜值底部feed流
SCAN_DIARY_CARDS_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "scan_request.yaml")
SCAN_DIARY_CARDS_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/scan_data", "diary_cards.yaml")
# 测肤质feed流
SKIN_RECOMMEND_SERVICE_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "skin_request.yaml")
SKIN_RECOMMEND_SERVICE_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/skin_data", "recommend_service.yaml")
# 测肤结果页 / AI变脸结果页
GMAI_SKIN_NEWREPORT_CONFIG = os.path.join(BASE_DIR, "backend_auto/all_backend_api", "gmai_request.yaml")
GMAI_SKIN_NEWREPORT_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/gmai_data", "skin_newReport.yaml")
# 用户之前是否使用过测肤功能
GMAI_SKIN_USER_HAD_TEST_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/gmai_data", "skin_user_had_test.yaml")
# 模拟双眼皮
GMAI_EYELIDS_PLASTIC_DATA = os.path.join(BASE_DIR, "backend_auto/test_backend_data/gmai_data", "eyelids_plastic.yaml")
# 模拟发型
......
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.gmai_request import gmai_request
# 测肤结果页
class TestSkinUserHadTest:
data = BaseRequest().api_load(path_setting.GMAI_SKIN_USER_HAD_TEST_DATA)
skinhadtest_case, skinhadtest_data = get_ids(data, "skin_user_had_test")
@pytest.mark.parametrize("param", skinhadtest_data, ids=skinhadtest_case)
def test_skin_user_hadused(self, param):
r = gmai_request().skin_user_had_test(param["device_id"])
if r["error"] == 0:
data = r.get("data").get("user_have_scan_skin")
assert data is param["assert"]
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.scan_request import scan_request
# 测颜值底部feed流
class TestScanDiaryCards:
data = BaseRequest().api_load(path_setting.SCAN_DIARY_CARDS_DATA)
scandiarycards_case, scandiarycards_data = get_ids(data, "diary_cards")
@pytest.mark.parametrize("param",scandiarycards_data,ids=scandiarycards_case)
def test_diary_cards(self,param):
r = scan_request().scan_diary_cards(param["current_city_id"], param["page"], param["count"], param["feature_results"],param["feed_type"])
assert r["error"] == 0
assert len(r["data"]) == param["assert_nums"]
\ No newline at end of file
import pytest
from ids_list import get_ids
import path_setting
from in_common.base_request import BaseRequest
from all_backend_api.skin_request import skin_request
# 测肤底部feed流
class TestSkinRecommendServices:
data = BaseRequest().api_load(path_setting.SKIN_RECOMMEND_SERVICE_DATA)
skin_recommend_service_case, skin_recommend_service_data = get_ids(data, "recommend_service")
@pytest.mark.parametrize("param",skin_recommend_service_data,ids=skin_recommend_service_case)
def test_recommend_services(self,param):
r = skin_request().skin_recommend_service(param["device_id"], param["current_city_id"], param["appeal_tag_ids"],
param["offset"], param["size"])
if r["error"] == 0:
services = r["data"]["services"]
assert len(services) == param["assert_nums"]
skin_user_had_test:
-
case: "验证用户是否使用过测肤功能"
device_id: "androidid_7255c3398845cdd5"
assert: True
\ No newline at end of file
diary_cards:
-
case: "测颜值底部feed流"
current_city_id: "beijing"
page: 1
count: 10
feature_results: '["细凤眼","眼距过宽","双眼皮","一字眉","流畅","厚唇","宽鼻翼","重度眼袋","尖下巴","无法令纹","娃娃脸",""]'
feed_type: 1
assert_nums: 10
\ No newline at end of file
recommend_service:
-
case: "测肤底部feed流"
current_city_id: "beijing"
offset: 0
size: 10
appeal_tag_ids: '[2306,2303,2551,2355,2322,2337]'
device_id: "androidid_7255c3398845cdd5"
assert_nums: 10
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment