Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed - #241 The ML engine library does not work. #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 18 additions & 8 deletions ml/v1/ml-gen.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"net/url"
"strconv"
"strings"
"io/ioutil"
)

// Always reference these packages, just in case the auto-generated code
Expand Down Expand Up @@ -198,6 +199,10 @@ type GoogleApi__HttpBody struct {
// Data: HTTP body binary data.
Data string `json:"data,omitempty"`

// DataReader is a TensorTask modification to make sending files from GCS
// oh so much more efficient.
DataReader io.Reader `json:"-"`

// Extensions: Application specific response metadata. Must be set in
// the first response
// for streaming APIs.
Expand Down Expand Up @@ -2705,7 +2710,10 @@ func (c *ProjectsGetConfigCall) doRequest(alt string) (*http.Response, error) {
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:getConfig")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("GET", urls, body)
req, err := http.NewRequest("GET", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
Expand Down Expand Up @@ -2836,15 +2844,15 @@ func (c *ProjectsPredictCall) doRequest(alt string) (*http.Response, error) {
}
reqHeaders.Set("User-Agent", c.s.userAgent())
var body io.Reader = nil
body, err := googleapi.WithoutDataWrapper.JSONReader(c.googlecloudmlv1__predictrequest)
if err != nil {
return nil, err
}
body = strings.NewReader(c.googlecloudmlv1__predictrequest.HttpBody.Data)
reqHeaders.Set("Content-Type", "application/json")
c.urlParams_.Set("alt", alt)
urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+name}:predict")
urls += "?" + c.urlParams_.Encode()
req, _ := http.NewRequest("POST", urls, body)
req, err := http.NewRequest("POST", urls, body)
if err != nil {
return nil, err
}
req.Header = reqHeaders
googleapi.Expand(req.URL, map[string]string{
"name": c.name,
Expand Down Expand Up @@ -2884,10 +2892,12 @@ func (c *ProjectsPredictCall) Do(opts ...googleapi.CallOption) (*GoogleApi__Http
HTTPStatusCode: res.StatusCode,
},
}
target := &ret
if err := gensupport.DecodeResponse(target, res); err != nil {
b, err := ioutil.ReadAll(res.Body)
if err != nil {
return nil, err
}

ret.Data = string(b)
return ret, nil
// {
// "description": "Performs prediction on the data in the request.\nCloud ML Engine implements a custom `predict` verb on top of an HTTP POST\nmethod. \u003cp\u003eFor details of the request and response format, see the **guide\nto the [predict request format](/ml-engine/docs/v1/predict-request)**.",
Expand Down