From f0e8a37a7ff9132452a6b575163f897a90f17570 Mon Sep 17 00:00:00 2001 From: Paillat Date: Mon, 14 Aug 2023 23:24:01 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A5=20chore(test-google-vision.py):=20?= =?UTF-8?q?remove=20unused=20code=20and=20dependencies?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The test-google-vision.py file was deleted as it contained unused code and dependencies that were no longer needed. --- tests/test-google-vision.py | 61 ------------------------------------- 1 file changed, 61 deletions(-) delete mode 100644 tests/test-google-vision.py diff --git a/tests/test-google-vision.py b/tests/test-google-vision.py deleted file mode 100644 index 729c7a3..0000000 --- a/tests/test-google-vision.py +++ /dev/null @@ -1,61 +0,0 @@ -import io -import os -import asyncio - -# Imports the Google Cloud client library -from google.cloud import vision - -# we set the env variable GOOGLE_APPLICATION_CREDENTIALS to the path of the json file -os.environ[ - "GOOGLE_APPLICATION_CREDENTIALS" -] = "./../database/google-vision/botator-vision-8cd1030a7541.json" -# Instantiates a client -client = vision.ImageAnnotatorClient() - - -# The name of the image file to annotate -file_name = os.path.abspath("./../database/google-vision/label.jpg") -print(file_name) -# Loads the image into memory -with io.open(file_name, "rb") as image_file: - content = image_file.read() - -image = vision.Image(content=content) - -# Performs label detection on the image file -# response = client.label_detection(image=image) -# labels = response.label_annotations - -# print('Labels:') -# for label in labels: -# print(label.description) - - -async def get_labels(image): - response = client.label_detection(image=image) - labels = response.label_annotations - return labels - - -async def get_text(image): - response = client.text_detection(image=image) - texts = response.text_annotations - return texts - - -# now we print the labels -async def main(): - labels = await get_labels(image) - print("Labels:") - for label in labels: - print(label.description) - texts = await get_text(image) - print("Texts:") - for text in texts: - print(text.description) - - -# now we run the main function -if __name__ == "__main__": - loop = asyncio.get_event_loop() - loop.run_until_complete(main())