Skip to content

Latest commit

 

History

History
80 lines (59 loc) · 2.26 KB

File metadata and controls

80 lines (59 loc) · 2.26 KB

computer-vision-demo

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.

Setup instructions (after cloning from GitHub)

  1. Navigate to the project directory

    After cloning the repository, navigate into it:

    cd computer-vision-demo
    
  2. 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
  3. Create a virtual environment

    python3 -m venv venv
    
  4. Activate your virtual environment

    source venv/bin/activate
    
  5. Install dependencies

    pip install -r requirements.txt
    
  6. Create a .env file

    Add the following environment variable:

    CLOUDINARY_URL=cloudinary://<api_key>:<api_secret>@<cloud_name>
    
  7. Replace placeholders

    Update the .env file with your Cloudinary credentials, which you can find in the API Keys page of the Console Settings.

  8. Update the cloudName value

    In index.html, replace the value for cloudName with your Cloudinary cloud name.

  9. (First-time only) Create the upload preset

    In demo.py, uncomment the following block inside the index() 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.

  1. Run the Flask app
python demo.py