Closed itsmeritesh closed 1 month ago
Most likely the actual crash you're getting in the code above is because the image_file
object has already been read by your previous call to safe_search_detection
, so it's at EOF when you make the text_detection
call. Try calling image_file.rewind
to reset the file pointer before calling text_detection
. Or alternately, just read the file contents into a string first, and pass the string into both calls.
The other thing I notice from your code is, the call to Google::Cloud::Vision.configure
should not be necessary. The client library authentication already understands the GOOGLE_APPLICATION_CREDENTIALS
environment variable. (That is, it implements https://cloud.google.com/docs/authentication/application-default-credentials for you.)
In the future, consider posting usage questions to StackOverflow. Google Support generally doesn't monitor these GitHub repositories, and it's uncommon that you'll get a timely response here.
gThanks @dazuma. Appreciate your help here. I'll try these out now. Appreciate your note on the credentials bit too.
Hi folks, I'm building a simple text detection service but keep hitting a dead end in terms of # of arguments or type. Here's my code.
I get different errors like Invalid # of arguments, wrong file type etc, there's not much public code to go by. Is there something obvious I'm missing? Thanks.