Skip to content

Instantly share code, notes, and snippets.

View gauravkaila's full-sized avatar

Gaurav Kaila gauravkaila

View GitHub Profile
API Free Subscription Paid Subscription 1 Paid Subscription 2 Paid Subscription 3 Link
Clarifai First 5000 ops Pre-Built Models: $1.20 / 1000 ops Custom Models: $3.20 / 1000 operations NA https://clarifai.com/pricing
Sightengine First 2000 ops Starter: $2.9/1000 ops Growth: $2.475/1000 ops Pro: $1.995/1000 ops https://sightengine.com/pricing
DeepAI NA First 1M ops: $1.00/1000 Next 9M ops: $0.80/1000 Next 90M ops: $0.60/1000 https://deepai.org/pricing
Nudedetect First 5000 ops Pro: $4.95/1000 ops Ultra: $4.58/1000 ops Mega: $2.995/1000 ops https://rapidapi.com/Netspark/api/Nude%20Detect/pricing
Vrate First 7500 ops Pro: $0.99/1000 ops Mega: $0.89/1000 ops Ultra: $0.49/1000 ops https://vrate.net/#!/pricing
Picpurify First 2000 ops Pro: $1.63/1000 ops Ultra: $1.41/1000 ops Mega: $1.25/1000 ops https://www.picpurify.com/pricing.html
Nanonets First 1000 ops Small: $0.90/1000 ops Medium: $0.99/1000 ops Large: custom https://nanonets.com/pricing/
API suggestive_nudity explicit_nudity porn gore
Clarifai 40% 100% 100% 100%
Sightengine 50% 100% 100% 30%
DeepAI 60% 100% 100% 10%
Nudedetect 20% 100% 100% NA
Vrate 60% 100% 100% NA
Picpurify 100% 80% 90% 100%
Nanonets 100% 100% 100% 80%
for i in Image.list(workspace = ws,image_name=config['docker']['docker_image_name']):
if i.version == int(config['deploy']['docker_image_version']):
image = i
from azureml.core.webservice import AciWebservice
aciconfig = AciWebservice.deploy_configuration(cpu_cores = int(config['deploy']['cpu_cores']),
memory_gb = int(config['deploy']['memory']),
tags = {'area': "diabetes", 'type': "regression"},
description = "test")
# Create docker image
from azureml.core.image import Image, ContainerImage
image_config = ContainerImage.image_configuration(runtime= "python",
execution_script=config['docker']['path_scoring_script'],
conda_file=config['docker']['conda_env_file'],
tags = {'area': "diabetes", 'type': "regression"},
description = "test")
image = Image.create(name = config['docker']['docker_image_name'],
# Create conda environment for docker image
from azureml.core.conda_dependencies import CondaDependencies
# DEFINE CONDA DEPENDENCIES
myenv = CondaDependencies.create(pip_packages=ast.literal_eval(config['docker']['pip_packages']),conda_packages=ast.literal_eval(config['train']['conda_packages']))
myenv.add_pip_package("pynacl==1.2.1")
# CREATE CONDA ENVIRONMENT FILE
with open(config['docker']['conda_env_file'],"w") as f:
f.write(myenv.serialize_to_string())
# Retrive registered model by version and name
from azureml.core.model import Model
regression_models = Model.list(workspace=ws,name=config['train']['model_name'])
for m in regression_models:
if m.version == int(config['docker']['model_version']):
model = m
# Register the model
print('Registering model...')
model = run.register_model(model_name=config['train']['model_name'], model_path='./outputs/ridge_1.pkl')
print('Done registering model.')
src = ScriptRunConfig(source_directory='./',
script= config['train']['script'],
run_config=conda_run_config,
# pass the datastore reference as a parameter to the training script
arguments=['--data-folder', str(ds.as_download())]
)
run = exp.submit(config=src)
run.wait_for_completion(show_output=True)
# get the default datastore and upload data from local folder to VM
ds = ws.get_default_datastore()
print(ds.name, ds.datastore_type, ds.account_name, ds.container_name)
# Upload data to default data storage
data_folder = config['train']['data_folder']
ds.upload(config['train']['local_directory'],target_path=data_folder,overwrite=True)
print ('Finished Uploading Data.')
# Create an experiment
from azureml.core import Experiment
# NOTE: New experiment is created if one with the following name is not found
experiment_name = config['train']['experiment_name']
exp = Experiment(workspace=ws, name=experiment_name)
# Create a target compute - VM
from azureml.core.compute import DsvmCompute
from azureml.core.compute_target import ComputeTargetException