【阿里云高校计划】学习分享:汽车识别项目的尝试

主题

汽车识别项目尝试

主要逻辑

前台上传图片,后台处理后响应数据

主要代码剖析

const Core = require("@alicloud/pop-core");
const config = require("../config");
const coreConfig = {
	accessKeyId: config.aliyun.account.imageRecognize.accessKeyId,
	accessKeySecret: config.aliyun.account.imageRecognize.accessKeySecret,
	endpoint: "",
	apiVersion: "",
};
var params = {
	RegionId: "cn-shanghai",
};
requestOption = {
	method: "post",
};
/**
 * 服务调用
 * @param {{ImageURL:string}} payload 图片OSS地址
 * @param {string} recognizeType 识别类型
 * @returns {Promise<>}
 */
const serviceRequest = (payload, recognizeType) => {
	coreConfig.endpoint = recognizeType.endpoint;
	coreConfig.apiVersion = recognizeType.apiVersion;
	params = { ...params, ...payload };
	var client = new Core(coreConfig);
	return client.request(recognizeType.type, params, requestOption);
};
module.exports = {
	serviceRequest: serviceRequest,
};

后台源代码


欢迎加入阿里云高校计划
在这里插入图片描述

你可能感兴趣的:(阿里云AI训练营)