Code Monkey home page Code Monkey logo

google_vision_workspace's People

Contributors

4ctobias avatar deadbryam avatar faithoflifedev avatar highliuk avatar imhafeez avatar jluisrojas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

google_vision_workspace's Issues

DioException [bad response]: This exception was thrown because the response has a status code of 400 and RequestOptions.validateStatus was configured to throw for this status code.

Hello, I have opened this issue before in this issue, unfortunately I could not find a solution so I formatted my computer and it was solved. Now I encountered this problem again and I cannot solve it. I checked the api key, although it works on my other windows and mac devices, it does not work on a specific windows computer. What's different is that it was broken yesterday when I just turned off and turned on the computer while it was working. When I tested all the other APIs, I saw that they worked without any problems, so I do not think there is a problem with the internet. But I couldn't find the reason for this problem.

This code gives an error, I am 100% sure that the credentials are correct

final googleVision = await vision.GoogleVision.withJwt(jwtFromAsset)

Logs

I/flutter ( 6977): DioException [bad response]: This exception was thrown because the response has a status code of 400 and RequestOptions.validateStatus was configured to throw for this status code.
I/flutter ( 6977): The status code of 400 has the following meaning: "Client error - the request contains bad syntax or cannot be fulfilled"
I/flutter ( 6977): Read more about status codes at https://developer.mozilla.org/en-US/docs/Web/HTTP/Status
I/flutter ( 6977): In order to resolve this exception you typically have either to verify and fix your request code or you have to fix the server code.
I/Camera  ( 6977): refreshPreviewCaptureSession

Version

google_vision: 1.2.1

OS: Windows 11

Unhandled Exception: DioException [bad response]: The request returned an invalid status code of 400

Hello, when I tried it yesterday, the api was working, but when I tried it today, I saw that it was not working. I checked the service_credentials.json file, renewed it and created a new API key, but it didn't work.

This Code

final googleVision = await GoogleVision.withJwt(jwtFromAsset);

Error:

E/flutter ( 8608): #0      DioMixin.fetch.<anonymous closure> (package:dio/src/dio_mixin.dart:507:7)
E/flutter ( 8608): #1      _RootZone.runUnary (dart:async/zone.dart:1661:54)
E/flutter ( 8608): #2      _FutureListener.handleError (dart:async/future_impl.dart:174:22)
E/flutter ( 8608): #3      Future._propagateToListeners.handleError (dart:async/future_impl.dart:852:47)
E/flutter ( 8608): #4      Future._propagateToListeners (dart:async/future_impl.dart:873:13)
E/flutter ( 8608): #5      Future._completeError (dart:async/future_impl.dart:649:5)
E/flutter ( 8608): #6      _SyncCompleter._completeError (dart:async/future_impl.dart:60:12)
E/flutter ( 8608): #7      _Completer.completeError (dart:async/future_impl.dart:26:5)
E/flutter ( 8608): #8      Future.any.onError (dart:async/future.dart:620:45)
E/flutter ( 8608): #9      _RootZone.runBinary (dart:async/zone.dart:1666:54)
E/flutter ( 8608): #10     _FutureListener.handleError (dart:async/future_impl.dart:171:22)
E/flutter ( 8608): #11     Future._propagateToListeners.handleError (dart:async/future_impl.dart:852:47)

Edit: I found that the problem was caused by the token generator in the package. But I still haven't figured it out.
image

DioException 302 Error

Exception has occurred.
DioException (DioException [bad response]: The request returned an invalid status code of 302.)

The error is in the oauth.g.dart file. It was working yesterday, but doesn't seem to work today.

FormatException (FormatException: Unexpected character (at character 1)

Hello,
I added the service_credentials.json file to the assets and then ran the sample project, but I received this error.

final googleVision = await GoogleVision.withJwt(jwtFromAsset);
Exception has occurred.
FormatException (FormatException: Unexpected character (at character 1)
/data/user/0/com.example.vision_demo/cache/service_credentials.json
^

image

Video security

I want to build an app that allows users to upload videos. How can I use a package to filter the security of videos?

Unhandled Exception: FileSystemException: Cannot open file

I use the credentials json file (which I downloaded when creating Service Account). It has the following format
{
"type": "service_account",
"project_id": "",
"private_key_id": "",
"private_key": "",
"client_email": "",
"client_id": "",
"auth_uri": "",
"token_uri": "",
"auth_provider_x509_cert_url": "",
"client_x509_cert_url": ""
}
I put the file in "assets/a.json" and use the following code to read.

final String response = await rootBundle.loadString('assets/a.json');
final data = await json.decode(response);

final googleVision = await GoogleVision.withJwt("assets/a.json");
print(googleVision.toString());

then, the rootBundle can read the json file well, but GoogleVision.withJwt has error "Unhandled Exception: FileSystemException: Cannot open file"

Face Detection Enum Decoding

Resulting Face Annotations are misbehaving, I did some debugging and I think the decoding function is the problem since we're comparing the enum VALUE instead of the KEY to the returned value from Google Vision. This is resulting in LikeLihood.UNKNOWN all the time.
Screenshot 2023-03-09 at 12 15 31 PM

handwriting detection, application crashing when i call _processPickedImage

application is crashing when i am trying to do handwriting detection

I am not a developer so do not understand much about reading logs, so this may not be a bug

Future _processPickedImage() async {
if (imageFile == null) return;

final navigator = Navigator.of(context);
debugPrint('_processPickedImage called');

try {
  final image =
      await decodeImageFromList(File(imageFile!.path).readAsBytesSync());

  // final jsonImage = JsonImage(imageUri: imageFile!.path); // this does not work

  final byteData = await image.toByteData(format: ui.ImageByteFormat.png);
  if (byteData == null) {
    throw Exception('Failed to convert image to ByteData');
  }
  final uint8List = byteData.buffer.asUint8List();
  final base64Image = base64Encode(uint8List);

  final jsonImage = JsonImage(imageUri: base64Image);

  final requests = AnnotationRequests(
    requests: [
      AnnotationRequest(
        jsonImage: jsonImage,
        features: [Feature(type: AnnotationType.textDetection)],
      ),
    ],
  );

  final annotatedResponses =
      await googleVision.annotate(requests: requests);
  print('$annotatedResponses');
  String text =
      annotatedResponses.responses.first.fullTextAnnotation?.text ?? '';
  setState(() {
    recognizedText = text;
  });
  await navigator.push(
    MaterialPageRoute(
      builder: (BuildContext context) => ResultScreen(text: recognizedText),
    ),
  );
} catch (error) {
  print('Error during text recognition: $error');
}

}
WhatsApp Image 2023-12-22 at 16 11 08_927afc8e

Token expiry not handled properly

I got a "Unhandled Exception: DioException [bad response]: The request returned an invalid status code of 401".
Due to the token being expired.

As a workaround I refresh the entire GoogleVision object, but I think this should be handled in the class itself. (The infrastructure seems in place with the tokenExpired field, but it is not checked before making actual requests.)

SafeSearchAnnotation Json Response Object Name Incorrect

The Json response object name for SafeSearchAnnotation should be "safeSearchAnnotation".

safeSearchAnnotation: json['safeSearchAnnotations'] == null
? null
: SafeSearchAnnotation.fromJson(
json['safeSearchAnnotations'] as Map<String, dynamic>),

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.