[ https://issues.apache.org/jira/browse/BEAM-9247?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17036209#comment-17036209 ]
Elias Djurfeldt edited comment on BEAM-9247 at 2/13/20 1:12 PM: ---------------------------------------------------------------- How about something like this? [https://github.com/EDjur/beam/commit/cae4f82957017df31a68de36288b74db2616fa78#diff-0cd6945eb0fdc8a93cb9d7fef0859ca0R94] Have a look at the tests too to see how I envision it working. This keeps a single PTransform and DoFn, but accepts {code:java} @typehints.with_input_types( Union[Tuple[Union[text_type, binary_type], vision.types.ImageContext], Union[text_type, binary_type]]){code} Defaults the `image_context` to `None` and unpacks the tuple if needed. Only concern I have is it might be confusing having a PTransform that accepts either a tuple of (image, ImageContext) or just string of image. But this reduces code duplication quite a lot. was (Author: eliasdjur): How about something like this? [https://github.com/EDjur/beam/commit/cae4f82957017df31a68de36288b74db2616fa78#diff-0cd6945eb0fdc8a93cb9d7fef0859ca0R94] This keeps a single PTransform and DoFn, but accepts {code:java} @typehints.with_input_types( Union[Tuple[Union[text_type, binary_type], vision.types.ImageContext], Union[text_type, binary_type]]){code} Defaults the `image_context` to `None` and unpacks the tuple if needed. Only concern I have is it might be confusing having a PTransform that accepts either a tuple of (image, ImageContext) or just string of image. But this reduces code duplication quite a lot. > [Python] PTransform that integrates Cloud Vision functionality > -------------------------------------------------------------- > > Key: BEAM-9247 > URL: https://issues.apache.org/jira/browse/BEAM-9247 > Project: Beam > Issue Type: Sub-task > Components: io-py-gcp > Reporter: Kamil Wasilewski > Assignee: Elias Djurfeldt > Priority: Major > > The goal is to create a PTransform that integrates Google Cloud Vision API > functionality [1]. > [1] https://cloud.google.com/vision/docs/ -- This message was sent by Atlassian Jira (v8.3.4#803005)