s-tanoue / sign-reading

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Sign reader sample

This project is designed to be a sample Azure project using Computer Vision. You can use this to see how Computer Vision works, or as a starter for a project you're creating.

Requirements

Python

In order to run the site you will need Python installed locally. You can install Python by visiting the Python downloads page.

Azure Cognitive Services

To use Computer Vision you will need a key for Azure Cognitive Services. We will create this by using az hack create in Azure Cloud Shell.

  1. Navigate to the Azure Portal and authenticate with your account.

  2. Click the Cloud Shell icon towards the upper right Cloud Shell

  3. After the shell opens in the browser, issue the following command to install the az hack extension.

az extension add -n hack
  1. Issue the following command to create an App Service to host your website, an instance of MySQL for data, and a key for Cognitive Services.
az hack create -n signdemo -r python -d mysql -l westus2 --ai

NOTE: The command will add a random set of characters to the name you provide (signdemo in our example). This ensures the name will always be unique.

  1. Make a note of the COGSVCS_CLIENTURL and COGSVCS_KEY values; you'll be using those in just a few moments.

Local setup

  1. Open a command or terminal window. Clone the sample repository.
git clone https://github.com/geektrainer/sign-reader
  1. Navigate to the folder using a terminal or command window.
cd sign-reader
  1. Create a virtual environment using Python and install the libraries listed in requirements.txt
# Windows
python -m venv env
.\env\Scripts\activate
pip install -r requirements.txt

# macOS or Linux
python3 -m venv env
. ./env/bin/activate
pip3 install -r requirements.txt
  1. Open the folder in the code editor of your choice. If you are using Visual Studio Code you can use the command below.
code .
  1. Add a new file named .env, which is used by dotenv, which simulates environment variables. Add the text below, and then update the placeholders with the values you created in the earlier step.

NOTE: The leading . is required on the file name.

COGSVCS_CLIENTURL=<your url>
COGSVCS_KEY=<your key>
  1. Run your application!!! Return to the terminal or command window you had previously, and run the application in flask.
flask run
  1. Navigate to http://localhost:5000. Click Upload, and choose an image (such as the sample.jpg in this repository) which has text. The image and text will be displayed!

Deploy your project

Ready to take show your project to the world? If so, the az hack create utility you used previously will help you out. If you return to the portal shell, you'll notice steps to perform a Git deploy are listed there.

About


Languages

Language:HTML 57.3%Language:Python 27.6%Language:CSS 15.1%