我已经在GCP AI平台上部署了一个模型,可以成功地从我的Jupyter Notebook请求预测。但是,我需要执行来自Flutter应用程序请求,但似乎找不到这样做的方法。
以下代码在notebook上运行良好:
from google.api_core.client_options import ClientOptions
from googleapiclient import discovery
endpoint = 'https://australia-southeast1-ml.googleapis.com'
client_options = ClientOptions(api_endpoint=endpoint)
ml = discovery.build('ml', 'v1', client_options=client_options)
request_body = { 'instances': [image_content] }
request = ml.projects().predict(
name='projects/[PROJECT_NAME]/models/[MODEL_NAME]/versions/version1/',
body=request_body)
response = request.execute()
print(response)有没有办法将这段python代码转换为dart,以便在Flutter应用程序中使用?
https://stackoverflow.com/questions/67253350
复制相似问题