October 2019
Intermediate to advanced
426 pages
10h 8m
English
The extract_image_info() function implements the RESTful endpoint. Use the following code to continue with the Python code in app.py:
@app.route('/images/{image_id}/extract-info', methods = ['POST'], cors = True)def extract_image_info(image_id): """detects text in the specified image then extracts contact information from the text""" MIN_CONFIDENCE = 70.0 text_lines = recognition_service.detect_text(image_id) contact_lines = [] for line in text_lines: # check confidence if float(line['confidence']) >= MIN_CONFIDENCE: contact_lines.append(line['text']) contact_string = ' '.join(contact_lines) contact_info = extraction_service.extract_contact_info(contact_string) return contact_info
The annotation right above ...
Read now
Unlock full access