This commit is contained in:
Nathan Rashleigh committed 2024-04-06 16:54:58 +11:00
1 parent 1bb2662ea1
commit db6918fa6c
6 files changed
+213 -3

No files matched your search

+26
View File
@@ -0,0 +1,26 @@
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)