ml, deep learning,

Flask experiments

Gerald Haslhofer Gerald Haslhofer Follow Jan 01, 2020 · 1 min read
Flask experiments
Share this

Creating the code

https://towardsdatascience.com/quick-semantic-search-using-siamese-bert-networks-1052e7b4df1

Flask & sentence embedding demo notes

Trying to deploy python service to azure

Instructions: https://docs.microsoft.com/en-us/azure/app-service/containers/quickstart-python?toc=%2Fpython%2Fazure%2FTOC.json&tabs=bash

Install VS requirements

https://support.microsoft.com/en-us/help/2977003/the-latest-supported-visual-c-downloads

Create python environment

py -3 -m venv env env\scripts\activate pip install -r requirements.txt SET FLASK_APP=application.py flask run

Login to Azure portal and deploy Hello World app

az login az webapp up –sku F1 -n pybert -l westus2

Figure out dependencies the project has (generate requirements.txt

https://www.idiotinside.com/2015/05/10/python-auto-generate-requirements-txt/

$ pip install pipreqs $ pipreqs /path/to/project

Problem for sentence_transformer: can’t find torch >1.0.1 But other project has torch 1.1.0 ERROR: Could not find a version that satisfies the requirement torch>=1.0.1 (from sentence_transformers==0.2.5) (from versions: 0.1.2, 0.1.2.post1, 0.1.2.post2) ERROR: No matching distribution found for torch>=1.0.1 (from sentence_transformers==0.2.5)

manually install torch, but need proper requirements.txt

pip install torch==1.4.0+cpu torchvision==0.5.0+cpu -f https://download.pytorch.org/whl/torch_stable.html

Change requirements.txt to ensure we look in the right place for torch –find-links https://download.pytorch.org/whl/torch_stable.html torch==1.4.0+cpu