mirror of
https://github.com/Paillat-dev/Botator.git
synced 2026-01-02 01:06: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
|
from google.cloud import vision
|
||||||
|
|
||||||
# Instantiates a client
|
# 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):
|
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...")
|
debug("Processing image...")
|
||||||
image = vision.Image()
|
image = vision.Image()
|
||||||
image.source.image_uri = attachment.url
|
image.source.image_uri = attachment.url
|
||||||
|
|||||||
Reference in New Issue
Block a user