Thanks for the video. Just one hint for everyone having trouble with CORS towards the end: You need to "Enable CORS" on your OCR resource at the API gateway (like it was done during the initial API setup) and deploy the API again. You don't need the CORS plugin then.
thank you very much for the excellent tutorial this is helping me a lot, although I have a question about how I could save the values in a dynamodb table?
You are very welcome !! I am glad that it was helpful :) You need to make an API call (put request) and have your API gateway call a lambda function. You can use the following NodeJS lambda function. Please update the fields as needed. I hope this helps. Best Siamak 'use strict'; var querystring = require('querystring'); var AWS = require('aws-sdk'),documentClient = new AWS.DynamoDB.DocumentClient(); exports.writeInvoice = function(event, context, callback){ const params = querystring.parse(event.body); var record = { Item : { "Invoice" : params['Invoice'], "Amount" : params['Amount'], "Date" : params['Date'], "Id": params['Id'], "Vendor" : params['Vendor'], "Company" : params['Company'], "Description" : params['Description'] }, TableName : "myTable" }; documentClient.put(record, function(err, data){ callback(err, data); }); } Also Update the handler to : index.writeInvoice
Hi Dileep, Thanks for watching the video. Yes that is correct. This can be commercialized after some adjustments and enhancements. This is just a POC :) Best Siamak
Hey! Thanks for the upload. Its really good to have some AWS dev videos for newbies. I have a question and a suggestion. Const UID is giving me an error saying "The const modifier can only be used in Typescript files". Any idea whats going on? Do i need typescript for this application? Two suggestions: 1) The video quality isnt great. Its super hard to see the code sometimes and the recording doesnt fill out the entire view screen of youtube. Also, the code in github has errors and spelling mistakes which aren't there in the actual video.
When i cloned your repo, it appears that const UID, var data, await fetch are all nested within async getFiles. Is this correct? Where I am stuck is at 1 hour 13 mins
Hi Richard, You are very welcome! Thanks for watching the video and I appreciate your feedback. UID belongs to the class. The error message tells me that you have the variable outside of a block. Please double check the code blocks. same with data, it belongs to the class. I hope this helps. Best Siamak
@@CodeEngine Thanks for the reply Siamak. I never actually comment on RU-vid videos for help, but noticed you replied to others so said I would try. Its much appreciated! Im not sure what exactly you mean by "belongs to the class". Do you mean to say it should not be nested within async getFiles? I have nested UID, data and await fetch within the getFiles block and it is now working for me. I am able to upload the image to s3 through this. However. "this.state.files[0].base64" did not work for me. This did. "this.state.files.base64" . Again, not sure if this is correct or not and will cause me issues later, but for now it is working. Please let me know if you think this is okay. Cheers Richard
Hi Richard, You are very welcome! I am glad to hear that you were able to get the project working. Sorry if my reply wasn't clear. It is definitely okay to use nested blocks as long as you have the proper opening and closing parenthesis. The reason I said "they belong to the class" is because of the scope of the variable. When you create a class and create a variable within the class you can use that variable anywhere inside the class. When you put the variable inside another block basically you are reducing the scope/visibility of that variable. There is no right or wrong answer to this situation you just need to think how your data is accessible in your component. I hope this helps Best Siamak
Hey Siamak. I have two design questions if you dont mind. Why did you choose node.js for the s3 lambda function and python for the textract function? Also, why did you have the api call begin on document upload rather than have a submit button? Cheers
Hi Richard, Thanks for watching the video! Great questions! Nodejs is faster than Python and it is a good candidate for uploading files (Node uses Chrome's V8 engine) but you can use Python as well. You can process the file after clicking the submit button however the idea is to upload the file and get the result instead of typing the numbers in the form and then save the invoice. I hope this helps Best Siamak
Hi Richard, You can process pdf files but you need to add the following method : textract.get_document_text_detection() For production you need to have a second Lambda function that processes your pdf files (you can detect the file extension in your react app) Best Siamak
Should it not return key value pairs for the label and value like Amount will be the label and its value will be the dollar amount. That way we don't have to use regular expression to extract the label and its value that we are trying to map on the UI fields.
Hi, thanks for the video. When i upload the image, i see precessing written above but the fields are always. The extraction doesn't work for me. What could be the problem please?!
Hi Mekkaoui, You are welcome! Thanks for watching the video. What do you see in your web browser console? You can go to the developer mode in Chrome and confirm that you are getting a proper response. You can also add a few console.log() statements to your code and print the values to the console. I hope this helps Best Siamak
Hi sir I am new in aws Thanks for this video it help me to understand follow also upload the image s3 by lembda... You mentioned in the video for Production we have to use presigned Url to upload in s3. I have one question I am building a chat app need to upload image in s3 and save image with the chat transscripts in ddb. How I can achieve this with this lembda function. can I use this process for production or use presigned url?
Hello, You are welcome! Yes you can definitely use this method. Presigned URL provides a link for user to upload an object to S3 without having AWS security credentials. Please note that presigned URLs have expiration date. I hope this helps Best Siamak
@@CodeEngine Thank you for your quick responce. I am going to use this method on proudction. can you please guid me how to save this image in ddb with user chat trans. and show in trans. real time. thank you so much
You are welcome! Insert the file name (path on S3), file type and all the information that you want to keep to your DynamoDB table. Basically you keep the file in S3 and metadata in DynamoDB. Best Siamak
@@CodeEngine Thank you so much. meanwhile I checked your other videos. your explaination is clear and awesome. I have one thing whenver you get time please make video on Amazon connect chat. in react. thanks
Hello, very interesting work.....I am trying to develop an app that reads from the web-browser or from the desktop in real time.. (like a traffic camera works on plates )..I am a python programmer,(intermediate level) any idea how to do this without a camera? Thank you.
Hi Dimitrios, Thank you! I am glad that you liked the video. Interesting project.. You can take a screenshot of users page using something like pyautogui with Python and then procces it on the fly and store the result in a database. This means you would have to build a data streaming pipeline over http to stream the screenshots with minimum bandwidth required. The second approach is to make a web browser scraper that is running in the background or as a plugin on a browser using beautiful soup in Python. I hope this helps Best Siamak
Hi! Before diving in. Is this still a valid solution in 2022? I see a lot of comments telling me this has some bugs. Thank you. I know this was a great effort.
Hi Kunchanapalli, Thank you for watching the video! I am glad that you liked it :) I just uploaded the sample invoice (Sample.png). Please check the repository : github.com/CodeEngineTechnology/OCR_WebApp Best Siamak
@@CodeEngine Hi again Siamak. I am encountering the CORS error on my web browser. I have enabled CORS extension, enabled CORS after building the POST method, and also selected while building the OCR resource. Yet it is throwing an error. I have also done the CORS configuration in the images bucket. The image is being uploaded to the S3 image bucket. Can you please help me out. Thanks :)
To be precise this is the error I am facing : Access to fetch at 'xxxxx.amazonaws.com/Production/ocr' from origin 'localhost:3000' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource. If an opaque response serves your needs, set the request's mode to 'no-cors' to fetch the resource with CORS disabled.
Hi Ajitesh, New customers can analyze up to 1,000 pages per month using the Detect Document Text API and up to 100 pages per month using the Analyze Document API, for the first three months. After that : First 1 million pages is 0.0015 per page ($1.5 per 1,000) I hope this helps Best Siamak
hello siamak. i tried your code and the output text which you have received at 1:49:17 is from the OCR lamda function where you have mentioned "Sample.png" as the file path and not from the image which you have just uploaded. i came to know this after i tried other images and i was just getting the same sample.png output. i have replaced filePath= event to solve this. i want to try this with pdf's, need help.
Hi Sameer, Yes you can sign up for AWS Educate and receive up to $100 in AWS Promotional Credit with an AWS Educate Starter Account. I hope this helps. Best Siamak
@@CodeEngine Thanks for the quick reply. I am getting the following error when i test the lamda function for OCR. Can you help me out with this error? { "errorMessage": "An error occurred (AccessDeniedException) when calling the DetectDocumentText operation: User: arn:aws:sts: is not authorized to perform: textract:DetectDocumentText with an explicit deny", "errorType": "AccessDeniedException", "stackTrace": [ " File \"/var/task/lambda_function.py\", line 20, in lambda_handler 'Name': documentName ", " File \"/var/runtime/botocore/client.py\", line 316, in _api_call return self._make_api_call(operation_name, kwargs) ", " File \"/var/runtime/botocore/client.py\", line 635, in _make_api_call raise error_class(parsed_response, operation_name) " ] }
Hi, I am new to aws and when in the video at 6:56 you told to configure something but that part is missing in it, the key ganaration can you tell me what we need to do there?
Hi, Thanks for watching the video! 1) Please download AWS CLI from : aws.amazon.com/cli/ 2) Then create an IAM user in your AWS account and download your access key. 3) at the end open your command prompt and type aws configure I hope this helps Best Siamak
hello, love your video, you know your stuff and it shows that you are passionate through your video. The video sparked an idea, and I asked a developer to use your code as a starting point for something i have imagined up but he is claiming it couldnt be used for one reason or another. could you tell me why this could happen?
Actually what you had shared with me youtube for that project It's source code not working at all Thats why it's delaying I have created all the project from scratch me: why? Because we can't create mail and subscription module with aws (actually I think we can) But it will too messy For managing software Thats why I have choosed node And aws sdk ** full disclaimer, i am doubting the developer i’m working with not you, i’m just trying to understand since my knowledge in dev is limited
Thanks for sharing this information. Yes you can pretty much build everythig. Although I am sure your developer is a telented engineer, his skillset might not be the perfect fit for this project. I hope this helps. Best Siamak