Skip to content

Instantly share code, notes, and snippets.

guac is good

Selynna Sun selynna

guac is good
View GitHub Profile
View index.js
// Train classifier
let trainingIteration = await trainer.trainProject(;
console.log("Training started...");
while (trainingIteration.status == "Training") {
await setTimeoutPromise(1000, null);
trainingIteration = await trainer.getIteration(,
console.log("Training status: " + trainingIteration.status);
View index.js
console.log("Adding images...");
let fileUploadPromises = [];
const pizzaDir = `${dataRoot}/pizza`;
const pizzaFiles = fs.readdirSync(pizzaDir);
pizzaFiles.forEach(file => {
fileUploadPromises.push(trainer.createImagesFromData(, fs.readFileSync(`${pizzaDir}/${file}`), { tagIds: [] }));
await Promise.all(fileUploadPromises);
View index.js
# index.js
// Create project
const util = require('util');
const fs = require('fs');
const TrainingApiClient = require("azure-cognitiveservices-customvision-training");
const PredictionApiClient = require("azure-cognitiveservices-customvision-prediction");
const setTimeoutPromise = util.promisify(setTimeout);
View .env
# .env
TRAINING_KEY=<your training key>
PREDICTION_KEY=<your prediction key>
TRAINING_RESOURCE_ID=<your training resource id>
PREDICTION_RESOURCE_ID=<your prediction resource id>
|_ django_azure_demo/
|_ db.sqlite3
# django_azure_demo/
Django settings for django_azure_demo project.
Generated by 'django-admin startproject' using Django 1.11.20.
For more information on this file, see
For the full list of settings and their values, see
View web.config
<?xml version="1.0" encoding="UTF-8"?>
<add name="httpPlatformHandler" path="*" verb="*"
modules="httpPlatformHandler" resourceType="Unspecified" />
<httpPlatform processPath="D:\home\Python364x86\python.exe" arguments="" requestTimeout="00:04:00" startupTimeLimit="120" startupRetryCount="3" stdoutLogEnabled="true">
<environmentVariable name="PYTHONPATH" value="D:\home\site\wwwroot" />
import os
from waitress import serve
from django.core.wsgi import get_wsgi_application
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "django_azure_demo.settings")
application = get_wsgi_application()
View .deployment
command = deploy.cmd
You can’t perform that action at this time.