-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogodetection.py
49 lines (34 loc) · 1.26 KB
/
logodetection.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
GOOGLE_APPLICATION_CREDENTIALS="C:/Users/rmisr/Downloads/LogoDetection-4f4b8a3b6759.json"
def detect_logos(path):
"""Detects logos in the file."""
from google.cloud import vision
import io
client = vision.ImageAnnotatorClient()
with io.open(path, 'rb') as image_file:
content = image_file.read()
image = vision.types.Image(content=content)
response = client.logo_detection(image=image)
logos = response.logo_annotations
print('Logos:')
for logo in logos:
print(logo.description)
def implicit():
from google.cloud import storage
# If you don't specify credentials when constructing the client, the
# client library will look for credentials in the environment.
storage_client = storage.Client()
# Make an authenticated API request
buckets = list(storage_client.list_buckets())
print(buckets)
# implicit()
path = "./WinterGoalTests/cheetos.jpg"
detect_logos(path)
# Imports the Google Cloud client library
# from google.cloud import storage
# # Instantiates a client
# storage_client = storage.Client()
# # The name for the new bucket
# bucket_name = 'my-new-bucket'
# # Creates the new bucket
# bucket = storage_client.create_bucket(bucket_name)
# print('Bucket {} created.'.format(bucket.name))