דילוג לתוכן
  • חוקי הפורום
  • פופולרי
  • לא נפתר
  • משתמשים
  • חיפוש גוגל בפורום
  • צור קשר
עיצובים
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • ברירת מחדל (ללא עיצוב (ברירת מחדל))
  • ללא עיצוב (ברירת מחדל)
כיווץ
מתמחים טופ
  1. דף הבית
  2. קטגוריות בהרצה
  3. תכנות
  4. Python
  5. עזרה הדדית - Python
  6. שאלה | עזרה בקלוד של גוגל

שאלה | עזרה בקלוד של גוגל

מתוזמן נעוץ נעול הועבר נפתר עזרה הדדית - Python
2 פוסטים 1 כותבים 87 צפיות 1 עוקבים
  • מהישן לחדש
  • מהחדש לישן
  • הכי הרבה הצבעות
תגובה
  • תגובה כנושא
התחברו כדי לפרסם תגובה
נושא זה נמחק. רק משתמשים עם הרשאות מתאימות יוכלו לצפות בו.
  • THMHET מנותק
    THMHET מנותק
    THMHE
    כתב נערך לאחרונה על ידי THMHE
    #1

    אני מנסה להשתמש בענן של גוגל בשביל להשתמש בתוכנה של זיהוי טקסט מתמונה
    אני פועל בדיוק לפי המדריך שמופיע פה
    אני מדביק את הפקודה הזאת ולוחץ אנטר:

    from typing import Sequence
    
    from google.cloud import vision
    
    
    def analyze_image_from_uri(
        image_uri: str,
        feature_types: Sequence,
    ) -> vision.AnnotateImageResponse:
        client = vision.ImageAnnotatorClient()
    
        image = vision.Image()
        image.source.image_uri = image_uri
        features = [vision.Feature(type_=feature_type) for feature_type in feature_types]
        request = vision.AnnotateImageRequest(image=image, features=features)
    
        response = client.annotate_image(request=request)
    
        return response
    
    
    def print_labels(response: vision.AnnotateImageResponse):
        print("=" * 80)
        for label in response.label_annotations:
            print(
                f"{label.score:4.0%}",
                f"{label.description:5}",
                sep=" | ",
            )
                    
    

    אבל מקבל את השגיאה הזאת:

    _InactiveRpcError                         Traceback (most recent call last)
    File ~/venv-vision/lib/python3.12/site-packages/google/api_core/grpc_helpers.py:76, in _wrap_unary_errors.<locals>.error_remapped_callable(*args, **kwargs)
         75 try:
    ---> 76     return callable_(*args, **kwargs)
         77 except grpc.RpcError as exc:
    
    File ~/venv-vision/lib/python3.12/site-packages/grpc/_channel.py:1181, in _UnaryUnaryMultiCallable.__call__(self, request, timeout, metadata, credentials, wait_for_ready, compression)
       1175 (
       1176     state,
       1177     call,
       1178 ) = self._blocking(
       1179     request, timeout, metadata, credentials, wait_for_ready, compression
       1180 )
    -> 1181 return _end_unary_response_blocking(state, call, False, None)
    
    File ~/venv-vision/lib/python3.12/site-packages/grpc/_channel.py:1006, in _end_unary_response_blocking(state, call, with_call, deadline)
       1005 else:
    -> 1006     raise _InactiveRpcError(state)
    
    _InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
            status = StatusCode.PERMISSION_DENIED
            details = "This API method requires billing to be enabled. Please enable billing on project #cor-in-hebreow by visiting https://console.developers.google.com/billing/enable?project=cor-in-hebreow then retry. If you enabled billing for this project recently, wait a few minutes for the action to propagate to our systems and retry."
            debug_error_string = "UNKNOWN:Error received from peer ipv4:108.177.127.95:443 {created_time:"2024-11-08T08:10:26.797474025+00:00", grpc_status:7, grpc_message:"This API method requires billing to be enabled. Please enable billing on project #cor-in-hebreow by visiting https://console.developers.google.com/billing/enable?project=cor-in-hebreow then retry. If you enabled billing for this project recently, wait a few minutes for the action to propagate to our systems and retry."}"
    >
    
    The above exception was the direct cause of the following exception:
    
    PermissionDenied                          Traceback (most recent call last)
    Cell In[3], line 4
          1 image_uri = "gs://cloud-samples-data/vision/label/setagaya.jpeg"
          2 features = [vision.Feature.Type.LABEL_DETECTION]
    ----> 4 response = analyze_image_from_uri(image_uri, features)
          5 print_labels(response)
    
    Cell In[2], line 17, in analyze_image_from_uri(image_uri, feature_types)
         14 features = [vision.Feature(type_=feature_type) for feature_type in feature_types]
         15 request = vision.AnnotateImageRequest(image=image, features=features)
    ---> 17 response = client.annotate_image(request=request)
         19 return response
    
    File ~/venv-vision/lib/python3.12/site-packages/google/cloud/vision_helpers/__init__.py:76, in VisionHelpers.annotate_image(self, request, retry, timeout, metadata)
         74 elif len(request.features) == 0:
         75     request.features = self._get_all_features()
    ---> 76 r = self.batch_annotate_images(
         77     requests=[request], retry=retry, timeout=timeout, metadata=metadata
         78 )
         79 return r.responses[0]
    
    File ~/venv-vision/lib/python3.12/site-packages/google/cloud/vision_v1/services/image_annotator/client.py:802, in ImageAnnotatorClient.batch_annotate_images(self, request, requests, retry, timeout, metadata)
        799 self._validate_universe_domain()
        801 # Send the request.
    --> 802 response = rpc(
        803     request,
        804     retry=retry,
        805     timeout=timeout,
        806     metadata=metadata,
        807 )
        809 # Done; return the response.
        810 return response
    
    File ~/venv-vision/lib/python3.12/site-packages/google/api_core/gapic_v1/method.py:131, in _GapicCallable.__call__(self, timeout, retry, compression, *args, **kwargs)
        128 if self._compression is not None:
        129     kwargs["compression"] = compression
    --> 131 return wrapped_func(*args, **kwargs)
    
    File ~/venv-vision/lib/python3.12/site-packages/google/api_core/grpc_helpers.py:78, in _wrap_unary_errors.<locals>.error_remapped_callable(*args, **kwargs)
         76     return callable_(*args, **kwargs)
         77 except grpc.RpcError as exc:
    ---> 78     raise exceptions.from_grpc_error(exc) from exc
    
    PermissionDenied: 403 This API method requires billing to be enabled. Please enable billing on project #cor-in-hebreow by visiting https://console.developers.google.com/billing/enable then retry. If you enabled billing for this project recently, wait a few minutes for the action to propagate to our systems and retry. [links {
      description: "Google developers console billing"
      url: "https://console.developers.google.com/billing/enable"
    }
    , reason: "BILLING_DISABLED"
    domain: "googleapis.com"
    metadata {
      key: "service"
      value: "vision.googleapis.com"
    }
    metadata {
      key: "consumer"
      value: "projects/cor-in-hebreow"
    }
    ]
    

    במדריך של גוגל כתוב שאם אני מקבל את השגיאה הזאת: PermissionDenied
    אז לחזור לדף הזה, אבל חזרתי והגדרתי הכל כמו שצריך ועדיין זה לא עובד.

    I love to learn
    I learn English and Python

    THMHET תגובה 1 תגובה אחרונה
    0
    • THMHET THMHE סימן נושא זה כשאלה
    • THMHET THMHE סימן נושא זה כנפתר
    • THMHET THMHE

      אני מנסה להשתמש בענן של גוגל בשביל להשתמש בתוכנה של זיהוי טקסט מתמונה
      אני פועל בדיוק לפי המדריך שמופיע פה
      אני מדביק את הפקודה הזאת ולוחץ אנטר:

      from typing import Sequence
      
      from google.cloud import vision
      
      
      def analyze_image_from_uri(
          image_uri: str,
          feature_types: Sequence,
      ) -> vision.AnnotateImageResponse:
          client = vision.ImageAnnotatorClient()
      
          image = vision.Image()
          image.source.image_uri = image_uri
          features = [vision.Feature(type_=feature_type) for feature_type in feature_types]
          request = vision.AnnotateImageRequest(image=image, features=features)
      
          response = client.annotate_image(request=request)
      
          return response
      
      
      def print_labels(response: vision.AnnotateImageResponse):
          print("=" * 80)
          for label in response.label_annotations:
              print(
                  f"{label.score:4.0%}",
                  f"{label.description:5}",
                  sep=" | ",
              )
                      
      

      אבל מקבל את השגיאה הזאת:

      _InactiveRpcError                         Traceback (most recent call last)
      File ~/venv-vision/lib/python3.12/site-packages/google/api_core/grpc_helpers.py:76, in _wrap_unary_errors.<locals>.error_remapped_callable(*args, **kwargs)
           75 try:
      ---> 76     return callable_(*args, **kwargs)
           77 except grpc.RpcError as exc:
      
      File ~/venv-vision/lib/python3.12/site-packages/grpc/_channel.py:1181, in _UnaryUnaryMultiCallable.__call__(self, request, timeout, metadata, credentials, wait_for_ready, compression)
         1175 (
         1176     state,
         1177     call,
         1178 ) = self._blocking(
         1179     request, timeout, metadata, credentials, wait_for_ready, compression
         1180 )
      -> 1181 return _end_unary_response_blocking(state, call, False, None)
      
      File ~/venv-vision/lib/python3.12/site-packages/grpc/_channel.py:1006, in _end_unary_response_blocking(state, call, with_call, deadline)
         1005 else:
      -> 1006     raise _InactiveRpcError(state)
      
      _InactiveRpcError: <_InactiveRpcError of RPC that terminated with:
              status = StatusCode.PERMISSION_DENIED
              details = "This API method requires billing to be enabled. Please enable billing on project #cor-in-hebreow by visiting https://console.developers.google.com/billing/enable?project=cor-in-hebreow then retry. If you enabled billing for this project recently, wait a few minutes for the action to propagate to our systems and retry."
              debug_error_string = "UNKNOWN:Error received from peer ipv4:108.177.127.95:443 {created_time:"2024-11-08T08:10:26.797474025+00:00", grpc_status:7, grpc_message:"This API method requires billing to be enabled. Please enable billing on project #cor-in-hebreow by visiting https://console.developers.google.com/billing/enable?project=cor-in-hebreow then retry. If you enabled billing for this project recently, wait a few minutes for the action to propagate to our systems and retry."}"
      >
      
      The above exception was the direct cause of the following exception:
      
      PermissionDenied                          Traceback (most recent call last)
      Cell In[3], line 4
            1 image_uri = "gs://cloud-samples-data/vision/label/setagaya.jpeg"
            2 features = [vision.Feature.Type.LABEL_DETECTION]
      ----> 4 response = analyze_image_from_uri(image_uri, features)
            5 print_labels(response)
      
      Cell In[2], line 17, in analyze_image_from_uri(image_uri, feature_types)
           14 features = [vision.Feature(type_=feature_type) for feature_type in feature_types]
           15 request = vision.AnnotateImageRequest(image=image, features=features)
      ---> 17 response = client.annotate_image(request=request)
           19 return response
      
      File ~/venv-vision/lib/python3.12/site-packages/google/cloud/vision_helpers/__init__.py:76, in VisionHelpers.annotate_image(self, request, retry, timeout, metadata)
           74 elif len(request.features) == 0:
           75     request.features = self._get_all_features()
      ---> 76 r = self.batch_annotate_images(
           77     requests=[request], retry=retry, timeout=timeout, metadata=metadata
           78 )
           79 return r.responses[0]
      
      File ~/venv-vision/lib/python3.12/site-packages/google/cloud/vision_v1/services/image_annotator/client.py:802, in ImageAnnotatorClient.batch_annotate_images(self, request, requests, retry, timeout, metadata)
          799 self._validate_universe_domain()
          801 # Send the request.
      --> 802 response = rpc(
          803     request,
          804     retry=retry,
          805     timeout=timeout,
          806     metadata=metadata,
          807 )
          809 # Done; return the response.
          810 return response
      
      File ~/venv-vision/lib/python3.12/site-packages/google/api_core/gapic_v1/method.py:131, in _GapicCallable.__call__(self, timeout, retry, compression, *args, **kwargs)
          128 if self._compression is not None:
          129     kwargs["compression"] = compression
      --> 131 return wrapped_func(*args, **kwargs)
      
      File ~/venv-vision/lib/python3.12/site-packages/google/api_core/grpc_helpers.py:78, in _wrap_unary_errors.<locals>.error_remapped_callable(*args, **kwargs)
           76     return callable_(*args, **kwargs)
           77 except grpc.RpcError as exc:
      ---> 78     raise exceptions.from_grpc_error(exc) from exc
      
      PermissionDenied: 403 This API method requires billing to be enabled. Please enable billing on project #cor-in-hebreow by visiting https://console.developers.google.com/billing/enable then retry. If you enabled billing for this project recently, wait a few minutes for the action to propagate to our systems and retry. [links {
        description: "Google developers console billing"
        url: "https://console.developers.google.com/billing/enable"
      }
      , reason: "BILLING_DISABLED"
      domain: "googleapis.com"
      metadata {
        key: "service"
        value: "vision.googleapis.com"
      }
      metadata {
        key: "consumer"
        value: "projects/cor-in-hebreow"
      }
      ]
      

      במדריך של גוגל כתוב שאם אני מקבל את השגיאה הזאת: PermissionDenied
      אז לחזור לדף הזה, אבל חזרתי והגדרתי הכל כמו שצריך ועדיין זה לא עובד.

      THMHET מנותק
      THMHET מנותק
      THMHE
      כתב נערך לאחרונה על ידי
      #2

      ברוך השם, פשוט שכחתי להפעיל לפרויקט הזה את ההרשאות API

      I love to learn
      I learn English and Python

      תגובה 1 תגובה אחרונה
      0

      • התחברות

      • אין לך חשבון עדיין? הרשמה

      • התחברו או הירשמו כדי לחפש.
      • פוסט ראשון
        פוסט אחרון
      0
      • חוקי הפורום
      • פופולרי
      • לא נפתר
      • משתמשים
      • חיפוש גוגל בפורום
      • צור קשר