import boto3 import logging logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s') textract_client = boto3.client('textract', region_name='us-west-2') def extract_text_aws(file_content): try: response = textract_client.detect_document_text(Document={'Bytes': file_content}) text = ' '.join([item['Text'] for item in response['Blocks'] if item['BlockType'] == 'WORD']) return text except Exception as e: logging.error(f"Error in AWS Textract: {str(e)}") return ""