Here's a small taste of what you create with Cloudinary's vast analysis capabilities. The possibilities are endless!
In this demo, you'll be asked upload up to 3 images. Cloudinary will analyze those assets and return the images automatically transformed accordingly along with a description.
-
Navigate to the project directory
After cloning the repository, navigate into it:
cd computer-vision-demo -
Enable required add-ons
Go to the Add-ons page of the Console Settings and enable:
- Auto Tagging by Google
- OCR Text Detection and Extraction
- AI Moderation by Amazon Rekognition
-
Create a virtual environment
python3 -m venv venv -
Activate your virtual environment
source venv/bin/activate -
Install dependencies
pip install -r requirements.txt -
Create a
.envfileAdd the following environment variable:
CLOUDINARY_URL=cloudinary://<api_key>:<api_secret>@<cloud_name> -
Replace placeholders
Update the
.envfile with your Cloudinary credentials, which you can find in the API Keys page of the Console Settings. -
Update the
cloudNamevalueIn
index.html, replace the value forcloudNamewith your Cloudinary cloud name. -
(First-time only) Create the upload preset
In
demo.py, uncomment the following block inside theindex()route the first time you run the app:
# Create the upload preset only once:
cloudinary.api.create_upload_preset(
name = "docs_computer_vision_demo",
unsigned = True,
use_filename=True,
folder="docs/computer_vision_demo",
tags="computer_vision_demo",
colors= True,
faces= True,
categorization = "google_tagging", auto_tagging = 0.7,
ocr = "adv_ocr",
moderation = "aws_rek"
)
Note: Remember to replace the comments after the first run.
- Run the Flask app
python demo.py