Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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.
|
| 29 |
)
|
| 30 |
-
if result.
|
| 31 |
-
|
| 32 |
-
for
|
| 33 |
-
|
| 34 |
-
|
| 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 ***"
|