mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 09:16:19 +00:00
[VISION] Made vision not mandatory
This commit is contained in:
@@ -7,10 +7,17 @@ from config import debug
|
||||
from google.cloud import vision
|
||||
|
||||
# Instantiates a client
|
||||
client = vision.ImageAnnotatorClient()
|
||||
try:
|
||||
client = vision.ImageAnnotatorClient()
|
||||
except:
|
||||
debug("Google Vision API is not setup, please run /setup")
|
||||
|
||||
|
||||
|
||||
async def process(attachment):
|
||||
if not os.path.exists("./../database/google-vision"):
|
||||
debug("Google Vision API is not setup, please run /setup")
|
||||
return
|
||||
debug("Processing image...")
|
||||
image = vision.Image()
|
||||
image.source.image_uri = attachment.url
|
||||
|
||||
Reference in New Issue
Block a user