File tree Expand file tree Collapse file tree 2 files changed +6
-4
lines changed
translation/samples/snippets/hybrid_glossaries Expand file tree Collapse file tree 2 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,7 @@ def pic_to_text(infile):
56
56
# For less dense text, use text_detection
57
57
response = client .document_text_detection (image = image )
58
58
text = response .full_text_annotation .text
59
+ print ("Detected text: {}" .format (text ))
59
60
60
61
return text
61
62
# [END translate_hybrid_vision]
Original file line number Diff line number Diff line change 13
13
# limitations under the License.
14
14
15
15
import os
16
- import re
17
16
import sys
18
17
import uuid
19
18
29
28
# VISION TESTS
30
29
31
30
32
- def test_vision_standard_format ():
31
+ def test_vision_standard_format (capsys ):
33
32
# Generate text using Vision API
34
- text = pic_to_text ('resources/standard_format.jpeg' )
33
+ pic_to_text ('resources/standard_format.jpeg' )
34
+ out , err = capsys .readouterr ()
35
35
36
- assert re .match (r"This\s?is\s?a\s?test!\s?" , text )
36
+ assert 'Detected text:' in out
37
+ assert 'test!' in out
37
38
38
39
39
40
def test_vision_non_standard_format ():
You can’t perform that action at this time.
0 commit comments