dhanishetty commited on
Commit
d79fc4c
·
verified ·
1 Parent(s): 9cff73b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -7
app.py CHANGED
@@ -25,14 +25,13 @@ def sample_ocr_image_file(image1, end_point, API_Key):
25
  # Extract text (OCR) from an image stream. This will be a synchronously (blocking) call.
26
  result = client.analyze(
27
  image_data=image_data,
28
- visual_features=[VisualFeatures.READ]
29
  )
30
- if result.read is not None:
31
- sentence = ''
32
- for line in result.read.blocks[0].lines:
33
- sentence += f" {line.text}" + "\n"
34
- print(f" Line: '{line.text}'")
35
- output = sentence
36
 
37
  except :
38
  output = "*** Please check EndPoint URL and API_KEY ***"
 
25
  # Extract text (OCR) from an image stream. This will be a synchronously (blocking) call.
26
  result = client.analyze(
27
  image_data=image_data,
28
+ visual_features=[VisualFeatures.OBJECTS]
29
  )
30
+ if result.objects is not None:
31
+ objectsList = ''
32
+ for object in result.objects.list:
33
+ objectsList += f" '{object.tags[0].name}', {object.bounding_box}, Confidence: {object.tags[0].confidence:.4f}" + "\n"
34
+ output = objectsList
 
35
 
36
  except :
37
  output = "*** Please check EndPoint URL and API_KEY ***"