{"id":93222,"date":"2020-03-31T10:47:26","date_gmt":"2020-03-31T02:47:26","guid":{"rendered":"http:\/\/4563.org\/?p=93222"},"modified":"2020-03-31T10:47:26","modified_gmt":"2020-03-31T02:47:26","slug":"%e5%9f%ba%e4%ba%8e-serverless-%e7%9a%84%e4%ba%ba%e5%b7%a5%e6%99%ba%e8%83%bd%e7%9b%b8%e5%86%8c%e5%b0%8f%e7%a8%8b%e5%ba%8f","status":"publish","type":"post","link":"http:\/\/4563.org\/?p=93222","title":{"rendered":"\u57fa\u4e8e Serverless \u7684\u4eba\u5de5\u667a\u80fd\u76f8\u518c\u5c0f\u7a0b\u5e8f"},"content":{"rendered":"<div>\n<div>\n<div>\n<h1>                  \u57fa\u4e8e Serverless \u7684\u4eba\u5de5\u667a\u80fd\u76f8\u518c\u5c0f\u7a0b\u5e8f               <\/h1>\n<p> <\/p>\n<div>\n<div> <span>\u8cc7\u6df1\u5927\u4f6c : scf10cent <\/span>  <span><i><\/i> 37<\/span> <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<\/p><\/div>\n<div isfirst=\"1\"> <\/p>\n<p>\u65e5\u5e38\u751f\u6d3b\u4e2d\uff0c\u6211\u4eec\u5e38\u5e38\u4f1a\u60f3\u8981\u300c\u641c\u7d22\u7167\u7247\u300d\u3002\u6bcf\u5f53\u5bfb\u627e\u5f88\u4e45\u8fdc\u7684\u7167\u7247\u65f6\uff0c\u8bb0\u5fc6\u6a21\u7cca\uff0c\u68c0\u7d22\u7167\u7247\u65f6\u53ea\u80fd\u60f3\u8d77\u5927\u81f4\u7684\u65f6\u95f4\uff0c\u7136\u540e\u4e00\u5f20\u5f20\u67e5\u770b\u3002\u8fd9\u6837\u4e0d\u4ec5\u6548\u7387\u4f4e\u4e0b\uff0c\u8fd8\u7ecf\u5e38\u4f1a\u6f0f\u6389\u6211\u4eec\u60f3\u627e\u7684\u7167\u7247\u3002<\/p>\n<p>\u8fd1\u51e0\u5e74\u5fae\u4fe1\u5c0f\u7a0b\u5e8f\u53d1\u5c55\u8fc5\u901f\uff0c\u5982\u679c\u6709\u8fd9\u4e48\u4e00\u6b3e\u8f6f\u4ef6\uff0c\u6211\u4eec\u53ea\u9700\u8981\u7528\u6587\u5b57\u7b80\u5355\u63cf\u8ff0\uff0c\u5c31\u80fd\u5b9e\u73b0\u56fe\u7247\u7684\u5feb\u901f\u68c0\u7d22\uff0c\u5c82\u4e0d\u662f\u5f88\u68d2\uff01<\/p>\n<p>\u672c\u9879\u76ee\u5c06\u4ee5\u5c0f\u7a0b\u5e8f\u4e3a\u4f8b\uff0c\u5728 Serverless \u67b6\u6784\u4e0a\u8fdb\u884c\u5f00\u53d1\u3002\u8be5\u5c0f\u7a0b\u5e8f\u5728\u4fdd\u7559\u76f8\u518c\u57fa\u7840\u529f\u80fd\uff08\u65b0\u5efa\u76f8\u518c\u3001\u5220\u9664\u76f8\u518c\u3001\u4e0a\u4f20\u56fe\u7247\u3001\u67e5\u770b\u56fe\u7247\u3001\u5220\u9664\u56fe\u7247\uff09\u4e0a\uff0c\u589e\u52a0\u4eba\u5de5\u667a\u80fd\u641c\u7d22 \u2014\u2014 \u5373\u7528\u6237\u4e0a\u4f20\u56fe\u7247\u4e4b\u540e\uff0c\u57fa\u4e8e Image Caption \u6280\u672f\uff0c\u81ea\u52a8\u5bf9\u56fe\u7247\u8fdb\u884c\u63cf\u8ff0\uff0c\u5b9e\u73b0 Image to Text \u7684\u8fc7\u7a0b\u3002\u8fd9\u6837\uff0c\u5f53\u7528\u6237\u8fdb\u884c\u641c\u7d22\u65f6\uff0c\u901a\u8fc7\u6587\u672c\u95f4\u7684\u76f8\u4f3c\u5ea6\uff0c\u5c31\u53ef\u4ee5\u8fd4\u56de\u6700\u8d34\u8fd1\u7684\u56fe\u7247\u3002<\/p>\n<h2>\u57fa\u7840\u8bbe\u8ba1<\/h2>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200519_5ec456f396c78.png\" alt=\"\u57fa\u4e8e Serverless \u7684\u4eba\u5de5\u667a\u80fd\u76f8\u518c\u5c0f\u7a0b\u5e8f\" \/><\/p>\n<p>\u8be5\u9879\u76ee\u8bbe\u8ba1\u4e3b\u8981\u62e5\u6709\u767b\u5f55\u3001\u76f8\u518c\u3001\u56fe\u7247\u4e0a\u4f20\u548c\u9884\u89c8\u529f\u80fd\uff0c\u4ee5\u53ca\u641c\u7d22\u529f\u80fd\u3002\u5982\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200519_5ec456f8b1979.png\" alt=\"\u57fa\u4e8e Serverless \u7684\u4eba\u5de5\u667a\u80fd\u76f8\u518c\u5c0f\u7a0b\u5e8f\" \/><\/p>\n<ul>\n<li>\n<p>\u6ce8\u518c\u529f\u80fd\u7684\u4e3b\u8981\u4f5c\u7528\u662f\uff1a\u901a\u8fc7\u83b7\u53d6\u7528\u6237\u7684\u552f\u4e00 id \uff08\u5fae\u4fe1\u4e2d\u7684 OpenId \uff09\uff0c\u6765\u5c06\u7528\u6237\u4fe1\u606f\u5b58\u50a8\u5230\u6570\u636e\u5e93\u4e2d\uff0c\u4e4b\u540e\u7684\u6240\u6709\u64cd\u4f5c\uff0c\u90fd\u9700\u8981\u4ee5\u8be5 id \u4f5c\u4e3a\u533a\u5206\uff1b<\/p>\n<\/li>\n<li>\n<p>\u76f8\u518c\u529f\u80fd\u4e3b\u8981\u5305\u62ec\u76f8\u518c\u7684\u589e\u5220\u67e5\u6539\u7b49\u529f\u80fd\uff1b<\/p>\n<\/li>\n<li>\n<p>\u56fe\u7247\u529f\u80fd\u5305\u62ec\u56fe\u7247\u4e0a\u4f20\u3001\u5220\u9664\u548c\u67e5\u770b\uff1b<\/p>\n<\/li>\n<li>\n<p>\u641c\u7d22\u529f\u80fd\u4e3b\u8981\u662f\u53ef\u4ee5\u67e5\u770b\u6307\u5b9a\u6807\u7b7e\u5bf9\u5e94\u7684\u56fe\u7247\u5217\u8868\uff0c\u4ee5\u53ca\u6307\u5b9a\u641c\u7d22\u5185\u5bb9\u5bf9\u5e94\u7684\u5217\u8868\u3002<\/p>\n<\/li>\n<\/ul>\n<p>\u5f53\u7136\u8fd9\u56db\u4e2a\u4e3b\u8981\u529f\u80fd\u548c\u6a21\u5757\u662f\u548c\u524d\u7aef\u5173\u7cfb\u7d27\u5bc6\u7684\u90e8\u5206\uff0c\u9664\u6b64\u4e4b\u5916\u8fd8\u6709\u540e\u7aef\u5f02\u6b65\u64cd\u4f5c\u7684\u4e24\u4e2a\u6a21\u5757\uff0c\u5206\u522b\u662f\u56fe\u50cf\u538b\u7f29\u548c\u56fe\u50cf\u63cf\u8ff0\u529f\u80fd\u3002<\/p>\n<h3>1. \u6ce8\u518c\u529f\u80fd\uff1a<\/h3>\n<p>\u6ce8\u518c\u529f\u80fd\u662f\u7528\u6237\u70b9\u51fb\u6ce8\u518c\u8d26\u53f7\u4e4b\u540e\uff0c\u6267\u884c\u7684\u52a8\u4f5c\u3002<\/p>\n<p>\u8be5\u52a8\u4f5c\u9700\u8981\u6ce8\u610f\uff0c\u6ce8\u518c\u4e4b\u524d\u9700\u5148\u5224\u65ad\u7528\u6237\u662f\u5426\u5df2\u7ecf\u6ce8\u518c\u8fc7\u3002\u5982\u679c\u5df2\u6ce8\u518c\u5219\u9ed8\u8ba4\u767b\u9646\uff0c\u5426\u5219\u8fdb\u884c\u6ce8\u518c\u5e76\u767b\u9646\u3002\u5f53\u7528\u6237\u4e0d\u60f3\u6ce8\u518c\u65f6\uff0c\u53ef\u4ee5\u70b9\u51fb\u4f53\u9a8c\u7a0b\u5e8f\uff0c\u5bf9\u7a0b\u5e8f\u5927\u90e8\u5206\u9875\u9762\u8fdb\u884c\u9884\u89c8\u3002\u4f46\u662f\u4e0d\u80fd\u5b9e\u73b0\u6709\u5173\u6570\u636e\u5e93\u7684\u589e\u5220\u6539\u67e5\u3002\u767b\u5f55\u529f\u80fd\u9875\u9762\u5982\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200519_5ec456fddff8d.png\" alt=\"\u57fa\u4e8e Serverless \u7684\u4eba\u5de5\u667a\u80fd\u76f8\u518c\u5c0f\u7a0b\u5e8f\" \/><\/p>\n<h3>2. \u76f8\u518c\u529f\u80fd\uff1a<\/h3>\n<p>\u5f53\u7528\u6237\u6ce8\u518c\u767b\u5f55\u4e4b\u540e\uff0c\u53ef\u4ee5\u5728\u76f8\u518c\u7ba1\u7406\u9875\u9762\u8fdb\u884c\u76f8\u518c\u76f8\u5173\u7684\u7ba1\u7406\uff0c\u5305\u62ec\u7f16\u8f91\u3001\u5220\u9664\u548c\u65b0\u5efa\u3002\u5728\u8fdb\u884c\u6dfb\u52a0\u548c\u4fee\u6539\u7684\u65f6\u5019\uff0c\u9700\u8981\u6ce8\u610f\u76f8\u518c\u540d\u79f0\u662f\u5426\u5df2\u7ecf\u5b58\u5728\uff1b\u5728\u8fdb\u884c\u5220\u9664\u3001\u4fee\u6539\u76f8\u518c\u7b49\u64cd\u4f5c\u65f6\u8981\u5224\u65ad\u7528\u6237\u662f\u5426\u6709\u64cd\u4f5c\u8be5\u76f8\u518c\u7684\u6743\u9650\u7b49\u3002\u76f8\u518c\u529f\u80fd\u539f\u578b\u5982\u56fe\u6240\u793a\uff1a<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200519_5ec45704945ac.png\" alt=\"\u57fa\u4e8e Serverless \u7684\u4eba\u5de5\u667a\u80fd\u76f8\u518c\u5c0f\u7a0b\u5e8f\" \/><\/p>\n<h3>3. \u56fe\u7247\u529f\u80fd\uff1a<\/h3>\n<p>\u56fe\u7247\u529f\u80fd\u4e3b\u8981\u5305\u62ec\u56fe\u7247\u5217\u8868\u4ee5\u53ca\u56fe\u7247\u83b7\u53d6\u3001\u4e0a\u4f20\u548c\u5220\u9664\u3002\u5728\u56fe\u7247\u83b7\u53d6\u4e0e\u5220\u9664\u7684\u8fc7\u7a0b\u4e2d\uff0c\u8981\u5bf9\u7528\u6237\u662f\u5426\u6709\u8be5\u9879\u64cd\u4f5c\u7684\u6743\u9650\u8fdb\u884c\u5224\u65ad\uff0c\u4e0a\u4f20\u65f6\u4e5f\u8981\u5224\u65ad\u662f\u5426\u6709\u4e0a\u4f20\u5230\u6307\u5b9a\u76f8\u518c\u7684\u6743\u9650\u3002\u56fe\u7247\u529f\u80fd\u76f8\u5173\u539f\u578b\u56fe\u5982\u6240\u793a\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200519_5ec4570a7bfc6.png\" alt=\"\u57fa\u4e8e Serverless \u7684\u4eba\u5de5\u667a\u80fd\u76f8\u518c\u5c0f\u7a0b\u5e8f\" \/><\/p>\n<p>\u56fe\u7247\u529f\u80fd\u90e8\u5206\u9664\u4e86\u7528\u6237\u4fa7\u53ef\u89c1\u7684\u529f\u80fd\uff0c\u8fd8\u6709\u5b9a\u65f6\u4efb\u52a1\u3002\u5f53\u7528\u6237\u4e0a\u4f20\u56fe\u7247\u4e4b\u540e\uff0c\u7cfb\u7edf\u4f1a\u5728\u540e\u53f0\u5f02\u6b65\u8fdb\u884c\u56fe\u50cf\u538b\u7f29\u3001\u56fe\u50cf\u63cf\u8ff0\u548c\u5173\u952e\u8bcd\u63d0\u53d6\u7b49\u3002\u6574\u4f53\u6d41\u7a0b\u5982\u56fe\u6240\u793a\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200519_5ec45710f312d.png\" alt=\"\u57fa\u4e8e Serverless \u7684\u4eba\u5de5\u667a\u80fd\u76f8\u518c\u5c0f\u7a0b\u5e8f\" \/><\/p>\n<h3>4. \u641c\u7d22\u529f\u80fd\uff1a<\/h3>\n<p>\u641c\u7d22\u529f\u80fd\u6307\u7684\u662f\u901a\u8fc7\u5173\u952e\u8bcd\u6216\u4f7f\u7528\u8005\u7684\u63cf\u8ff0\uff0c\u5f97\u5230\u76ee\u6807\u6570\u636e\u7684\u8fc7\u7a0b\u3002\u8fd9\u4e00\u529f\u80fd\u539f\u578b\u56fe\u5982\u56fe\u6240\u793a\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200519_5ec4571534d67.png\" alt=\"\u57fa\u4e8e Serverless \u7684\u4eba\u5de5\u667a\u80fd\u76f8\u518c\u5c0f\u7a0b\u5e8f\" \/><\/p>\n<p>\u8fd9\u4e00\u90e8\u5206\u7684\u96be\u70b9\u5728\u4e8e\u901a\u8fc7\u7528\u6237\u7684\u63cf\u8ff0\uff0c\u641c\u7d22\u5230\u76ee\u6807\u6570\u636e\u7684\u8fc7\u7a0b\u3002\u8fd9\u4e2a\u8fc7\u7a0b\u7684\u57fa\u672c\u6d41\u7a0b\u5982\u56fe\u6240\u793a\u3002<\/p>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200519_5ec4571ac94d0.png\" alt=\"\u57fa\u4e8e Serverless \u7684\u4eba\u5de5\u667a\u80fd\u76f8\u518c\u5c0f\u7a0b\u5e8f\" \/><\/p>\n<h2>\u9879\u76ee\u5f00\u53d1<\/h2>\n<h3>1. \u6570\u636e\u5e93\u5efa\u7acb<\/h3>\n<p><img decoding=\"async\" src=\"http:\/\/4563.org\/wp-content\/uploads\/2020\/05\/20200519_5ec45721f25b2.png\" alt=\"\u57fa\u4e8e Serverless \u7684\u4eba\u5de5\u667a\u80fd\u76f8\u518c\u5c0f\u7a0b\u5e8f\" \/><\/p>\n<p>\u6570\u636e\u5e93\u90e8\u5206\u4e3b\u8981\u5bf9\u76f8\u5173\u7684\u8868\u548c\u8868\u4e4b\u95f4\u7684\u5173\u7cfb\u8fdb\u884c\u5efa\u7acb\u3002 \u9996\u5148\u9700\u8981\u521b\u5efa\u9879\u76ee\u6240\u5fc5\u987b\u7684\u8868\uff1a<\/p>\n<pre><code>CREATE DATABASE `album`; CREATE TABLE `album`.`tags` ( `tid` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(255) NOT NULL , `remark` TEXT NULL , PRIMARY KEY (`tid`)) ENGINE = InnoDB; CREATE TABLE `album`.`category` ( `cid` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(255) NOT NULL , `sorted` INT NOT NULL DEFAULT '1' , `user` INT NOT NULL , `remark` TEXT NULL , `publish` DATE NOT NULL , `area` VARCHAR(255) NULL , PRIMARY KEY (`cid`)) ENGINE = InnoDB; CREATE TABLE `album`.`users` ( `uid` INT NOT NULL AUTO_INCREMENT , `nickname` TEXT NOT NULL , `wechat` VARCHAR(255) NOT NULL , `remark` TEXT NULL , PRIMARY KEY (`uid`)) ENGINE = InnoDB; CREATE TABLE `album`.`photo` ( `pid` INT NOT NULL AUTO_INCREMENT , `name` VARCHAR(255) NOT NULL , `small` VARCHAR(255) NOT NULL , `large` VARCHAR(255) NOT NULL , `category` INT NOT NULL , `tags` VARCHAR(255) NULL , `remark` TEXT NULL , `creattime` DATE NOT NULL , `creatarea` VARCHAR(255) NOT NULL , `user` INT NOT NULL ,  PRIMARY KEY (`pid`)) ENGINE = InnoDB; CREATE TABLE `album`.`photo_tags` ( `ptid` INT NOT NULL AUTO_INCREMENT , `tag` INT NOT NULL , `photo` INT NOT NULL , `remark` INT NULL , PRIMARY KEY (`ptid`)) ENGINE = InnoDB;  <\/code><\/pre>\n<p>\u521b\u5efa\u4e4b\u540e\uff0c\u9010\u6b65\u6dfb\u52a0\u8868\u4e4b\u95f4\u7684\u5173\u7cfb\u4ee5\u53ca\u90e8\u5206\u9650\u5236\u6761\u4ef6\uff1a<\/p>\n<pre><code>ALTER TABLE `photo_tags` ADD CONSTRAINT `photo_tags_tags_alter` FOREIGN KEY (`tag`) REFERENCES `tags`(`tid`) ON DELETE CASCADE ON UPDATE RESTRICT;  ALTER TABLE `photo_tags` ADD CONSTRAINT `photo_tags_photo_alter` FOREIGN KEY (`photo`) REFERENCES `photo`(`pid`) ON DELETE CASCADE ON UPDATE RESTRICT; ALTER TABLE `photo` ADD CONSTRAINT `photo_category_alter` FOREIGN KEY (`category`) REFERENCES `category`(`cid`) ON DELETE CASCADE ON UPDATE RESTRICT; ALTER TABLE `photo` ADD CONSTRAINT `photo_user_alter` FOREIGN KEY (`user`) REFERENCES `users`(`uid`) ON DELETE CASCADE ON UPDATE RESTRICT; ALTER TABLE `category` ADD CONSTRAINT `category_user_alter` FOREIGN KEY (`user`) REFERENCES `users`(`uid`) ON DELETE CASCADE ON UPDATE RESTRICT; ALTER TABLE `tags` ADD unique(`name`);  <\/code><\/pre>\n<h3>2. \u8ba9 Code \u98de\u8d77\u6765<\/h3>\n<ul>\n<li>\u5728\u4f7f\u7528\u4e4b\u524d\u60a8\u9700\u8981\u6709\u4e00\u4e2a\u817e\u8baf\u4e91\u7684\u8d26\u53f7\uff0c\u5e76\u4e14\u5f00\u901a\u4e86 SCF \u3001COS \u3001APIGW \u4ee5\u53ca CDB \u7b49\u76f8\u5173\u4ea7\u54c1\u6743\u9650\uff1b<\/li>\n<li>\u5c06\u9879\u76ee clone \u5230\u672c\u5730\uff0c\u914d\u7f6e\u81ea\u5df1\u7684\u5bc6\u94a5\u4fe1\u606f\u3001\u6570\u636e\u5e93\u4fe1\u606f\u3002\u914d\u7f6e\u6587\u4ef6\u5728 <code>cloudFunction<\/code> \u76ee\u5f55\u4e0b\u7684 <code>serverless.yaml<\/code> \u4e2d\uff1a<\/li>\n<\/ul>\n<pre><code># \u51fd\u6570\u4eec\u7684\u6574\u4f53\u914d\u7f6e\u4fe1\u606f Conf:   component: \"serverless-global\"   inputs:     region: ap-shanghai     runtime: Python3.6     handler: index.main_handler     include_common: .\/common     mysql_host: gz-c************************.com     mysql_user: root     mysql_password: S************************!     mysql_port: 6************************0     mysql_db: album     mini_program_app_id: asdsa************************dddd     mini_program_app_secret: fd340c4************************8744ee     tencent_secret_id: AKID1y************************l1q0kK     tencent_secret_key: cCoJ************************FZj5Oa     tencent_appid: 1256773370     cos_bucket: 'album-1256773370'     domain: album.0duzahn.com <\/code><\/pre>\n<p>\u7531\u4e8e\u6211\u76ee\u524d\u4f7f\u7528\u7684\u662f Serverless Components\uff0c\u6ca1\u6709\u5168\u5c40\u53d8\u91cf\u7b49\u3002\u6240\u4ee5\u5728\u6b64\u5904\u589e\u52a0\u4e86\u5168\u5c40\u53d8\u91cf\u7ec4\u4ef6\uff0c\u5728\u8fd9\u91cc\u8bbe\u7f6e\u597d\u5168\u5c40\u53d8\u91cf\uff0c\u5728\u4e4b\u540e\u7684 Components \u4e2d\u53ef\u4ee5\u76f4\u63a5\u5f15\u7528\uff0c\u4f8b\u5982\uff1a<\/p>\n<pre><code># \u521b\u5efa\u5b58\u50a8\u6876 CosBucket:   component: '@serverless\/tencent-website'   inputs:     code:       src: .\/cos     region:  ${Conf.region}     bucketName: ${Conf.cos_bucket} <\/code><\/pre>\n<ul>\n<li>\n<p>\u5b89\u88c5\u5fc5\u5907\u5de5\u5177\uff1aServerless Framework \u3001\u5c0f\u7a0b\u5e8f\u4e91\u5f00\u53d1 IDE \u3002\u7531\u4e8e\u672c\u9879\u76ee\u540e\u53f0\u5f00\u53d1\u8bed\u8a00\u662f Python\uff0c\u60a8\u4e5f\u9700\u8981\u4e00\u4e9b Python \u7684\u5f00\u53d1\u5de5\u5177\u4ee5\u53ca\u5305\u7ba1\u7406\u5de5\u5177\uff08 Python \u7248\u672c\u4e0d\u4f4e\u4e8e 3.6 \uff09<\/p>\n<\/li>\n<li>\n<p>\u5728\u90e8\u5206\u6587\u4ef6\u5939\u4e0b\u5b89\u88c5\u76f8\u5bf9\u5e94\u7684\u4f9d\u8d56\uff1a<\/p>\n<ul>\n<li>\n<p><code>cloudFunction\/album\/prdiction<\/code> \u9700\u8981\u5b89\u88c5 Pillow, opencv, tensorflow, jieba<\/p>\n<\/li>\n<li>\n<p><code>cloudFunction\/album\/getPhotoSearch<\/code> \u9700\u8981\u5b89\u88c5 gensim, jieba \u4ee5\u53ca collections<\/p>\n<\/li>\n<li>\n<p><code>cloudFunction\/album\/compression<\/code> \u9700\u8981\u5b89\u88c5 Pillow<\/p>\n<p>\uff08\u6ce8\u610f\uff0c\u5728\u5b89\u88c5\u7684\u65f6\u5019\u4e00\u5b9a\u8981\u7528 CentOS \u64cd\u4f5c\u7cfb\u7edf\u3002\u5982\u679c\u6ca1\u76f8\u5bf9\u5e94\u7cfb\u7edf\uff0c\u53ef\u4ee5\u5728\u8fd9\u91cc\u6253\u5305\u5bf9\u5e94\u7684\u4f9d\u8d56\uff1a http:\/\/serverless.0duzhan.com\/app\/scf_python_package_download\/\uff09<\/p>\n<\/li>\n<\/ul>\n<\/li>\n<li>\n<p>\u5c06\u9879\u76ee\u90e8\u7f72\u5230\u4e91\u7aef\uff0c\u53ea\u9700\u8981\u901a\u8fc7\u6307\u4ee4 <code>serverless --debug<\/code> \u5373\u53ef\uff1a<\/p>\n<\/li>\n<\/ul>\n<pre><code>DEBUG \u2500 Resolving the template's static variables.   DEBUG \u2500 Collecting components from the template.   DEBUG \u2500 Downloading any NPM components found in the template.   DEBUG \u2500 Analyzing the template's components dependencies.   DEBUG \u2500 Creating the template's components graph.   DEBUG \u2500 Syncing template state.   DEBUG \u2500 Executing the template's components graph.   DEBUG \u2500 Starting API-Gateway deployment with name APIService in the ap-shanghai region       ... ...     DEBUG \u2500 Updating configure...    DEBUG \u2500 Created function Album_Get_Photo_Search successful   DEBUG \u2500 Setting tags for function Album_Get_Photo_Search   DEBUG \u2500 Creating trigger for function Album_Get_Photo_Search   DEBUG \u2500 Deployed function Album_Get_Photo_Search successful   DEBUG \u2500 Uploaded package successful \/Users\/dfounderliu\/Documents\/code\/AIAlbum\/.serverless\/Album_Prediction.zip   DEBUG \u2500 Creating function Album_Prediction   DEBUG \u2500 Updating code...    DEBUG \u2500 Updating configure...    DEBUG \u2500 Created function Album_Prediction successful   DEBUG \u2500 Setting tags for function Album_Prediction   DEBUG \u2500 Creating trigger for function Album_Prediction   DEBUG \u2500 Trigger timer: timer not changed   DEBUG \u2500 Deployed function Album_Prediction successful    Conf:      region:                  ap-shanghai              ... ...              -          path:   \/photo\/delete         method: ANY         apiId:  api-g9u6r9wq       -          path:   \/album\/delete         method: ANY         apiId:  api-b4c4xrq8       -          path:   \/album\/add         method: ANY         apiId:  api-ml6q5koy    156s \u203a APIService \u203a done  <\/code><\/pre>\n<p>\u8fd9\u4e2a\u8fc7\u7a0b\uff0c\u53ea\u7528\u4e86 156s \u4fbf\u90e8\u7f72\u4e86\u6240\u6709\u51fd\u6570\u3002\u7136\u540e\u6253\u5f00\u5c0f\u7a0b\u5e8f\u7684 id \u5e26\u5165 <code>miniProgram<\/code> \u76ee\u5f55\uff0c\u5e76\u4e14\u586b\u5199\u81ea\u5df1\u7684 <code>appid<\/code> \u5728\u6587\u4ef6 <code>project.config.json<\/code> \u7684\u7b2c 17 \u884c\uff0c\u540c\u65f6\u4e5f\u8981\u914d\u7f6e\u81ea\u5df1\u9879\u76ee\u7684\u57fa\u7840\u76ee\u5f55\uff0c\u5c31\u662f API \u7f51\u5173\u7ed9\u6211\u4eec\u8fd4\u56de\u7684\u5730\u5740\uff0c\u5199\u5728 <code>app.js<\/code> \u7684\u7b2c 10 \u884c\uff0c\u6b64\u65f6\u9879\u76ee\u5c31\u53ef\u4ee5\u8fd0\u884c\u8d77\u6765\u4e86\u3002<\/p>\n<blockquote>\n<p>\u81ea\u53d6       <\/p><\/div>\n<div> <b>\u5927\u4f6c\u6709\u8a71\u8aaa<\/b> (<span>0<\/span>)        <\/div>\n<div> <\/div>\n<\/p><\/div>\n<\/p><\/div>\n<ul>\n<li>\n","protected":false},"excerpt":{"rendered":"<p>\u57fa\u4e8e Serverless \u7684\u4eba\u5de5&hellip;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[],"tags":[],"_links":{"self":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/93222"}],"collection":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=93222"}],"version-history":[{"count":0,"href":"http:\/\/4563.org\/index.php?rest_route=\/wp\/v2\/posts\/93222\/revisions"}],"wp:attachment":[{"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=93222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=93222"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/4563.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=93222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}