ahmedabu98 opened a new pull request, #37435:
URL: https://github.com/apache/beam/pull/37435
The notebook example returns one inference element, not a list. The current
code gives this error:
```
ERROR:apache_beam.runners.common:KeyError: 0 [while running '[20]: Print']
Traceback (most recent call last):
File "apache_beam/runners/common.py", line 1498, in
apache_beam.runners.common.DoFnRunner.process
File "apache_beam/runners/common.py", line 685, in
apache_beam.runners.common.SimpleInvoker.invoke_process
File "/tmp/ipython-input-3766419850.py", line 7, in process
translated_text = element.inference[0]['translation_text']
~~~~~~~~~~~~~~~~~^^^
KeyError: 0
```
Fixed by accessing the inference result directly
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]