如何解决在Google云端上部署Google应用导致[错误13]
我正在尝试部署一个flask应用程序,其目的是使用tensorflow通用编码器模型作为API来查找两个单词的相似性。
这是我的run.py文件
from flask import Flask,render_template,make_response,jsonify,request
import tensorflow_hub as hub
import numpy as np
import tensorflow as tf
module_url = "https://tfhub.dev/google/universal-sentence-encoder/4"
model = hub.load(module_url)
tf.keras.backend.clear_session()
app = Flask(__name__,template_folder='templates')
@app.route('/')
def menu():
return render_template("index.html")
def semantic(search1,search2):
comparison = model([search1,search2])
return np.inner(comparison[0],comparison[1])
@app.route('/<search1>/<search2>',methods=['POST','GET'])
def deploy(search1,search2):
compare = semantic(search1,search2)
compare = compare*100
compare = str(compare)
compare = compare.strip("")
response = {
"Semantic Similarity": compare
}
if request.method == 'POST':
return make_response(jsonify(response),200)
else:
return render_template("results.html",compare=compare)
if __name__ == "__main__":
app.run(host="127.0.0.1",port=8080,debug=True)
这是我的app.yaml文件
entrypoint: "gunicorn -b:$PORT main:app"
env: flex
runtime: python
runtime_config:
python_version: 3
这是我运行命令将应用程序部署到云构建时返回的错误
gcloud应用部署
我不知道该错误意味着什么,我尝试查看文档和堆栈,但是该错误使我感到困惑。感谢您抽出宝贵的时间对此进行研究。
(gcloud.app.deploy) Error Response: [13] Flex operation projects/semanticapi/regions/us-central1/operations/e2e4b7ca-8422-4467-a3d1-283f20b42a10 error [INTERNAL]: An internal error occurred while processing task /app-engine-flex/insert_flex_deployment/flex_create_resources>2020-08-16T18:17:13.041Z81750.jf.0: Deployment Manager operation semanticapi/operation-1597601835196-5ad02a9e11fd3-f13606cb-82bdf048 errors: [code: "RESOURCE_ERROR"location: "/deployments/aef-default-20200816t180434/resources/aef-default-20200816t180434"message: "{\"ResourceType\":\"compute.beta.regionAutoscaler\",\"ResourceErrorCode\":\"403\",\"ResourceErrorMessage\":{\"code\":403,\"message\":\"The caller does not have permission\",\"status\":\"PERMISSION_DENIED\",\"statusMessage\":\"Forbidden\",\"requestPath\":\"https://compute.googleapis.com/compute/beta/projects/semanticapi/regions/us-central1/autoscalers\",\"httpMethod\":\"POST\"}}"]
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。