27 lines
719 B
Python
27 lines
719 B
Python
from google.cloud import vision
|
|
from google.cloud.vision_v1 import types
|
|
|
|
from dotenv import load_dotenv
|
|
|
|
load_dotenv()
|
|
|
|
crows = 'https://cdn.discordapp.com/attachments/367936426962190336/1222335573855834214/AjPuqci.png?ex=6615d7b6&is=660362b6&hm=e364398ce7401334298eb82bddedab56d944f5833508fde4b07363b329a95c6f&'
|
|
|
|
# Authenticate the client
|
|
client = vision.ImageAnnotatorClient()
|
|
|
|
# Perform text detection
|
|
features = [types.Feature(type=types.Feature.Type.TEXT_DETECTION)]
|
|
request = {
|
|
'image': {
|
|
'source': { 'image_uri': crows }
|
|
},
|
|
'features': features
|
|
}
|
|
|
|
response: types.AnnotateImageResponse = client.annotate_image(request=request)
|
|
texts = response.text_annotations[0].description
|
|
|
|
print(texts)
|
|
|