Skip to content

Instantly share code, notes, and snippets.

@apkelly
Last active February 14, 2019 11:08
Show Gist options
  • Save apkelly/40c09c026ffa7b50a930283c01a1c13a to your computer and use it in GitHub Desktop.
Save apkelly/40c09c026ffa7b50a930283c01a1c13a to your computer and use it in GitHub Desktop.
CloudAutoMLService.kt
// Expected json response from webservice
//{
// "payload": [
// {
// "classification": {
// "score": 0.87991875
// },
// "displayName": "Andy"
// }
// ]
//}
interface CloudAutoMLService {
@POST("/v1beta1/projects/{project}/locations/{location}/models/{model}:predict")
fun classify(
@Header("Authorization") authorization: String,
@Path("project") project: String,
@Path("location") location: String,
@Path("model") model: String,
@Body body: CloudAutoMLModel
): Deferred<CloudResponse>
data class Score(val score: Double)
data class Classification(val classification: Score?, val displayName: String?)
data class CloudResponse(val payload: List<Classification>?)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment