Skip to content

Instantly share code, notes, and snippets.

View aymericdelab's full-sized avatar
🎯
Focusing

raschel aymericdelab

🎯
Focusing
View GitHub Profile
{
"name": "contract name",
"description": "contract description",
"interfaces": ["TZIP-012-2020-11-17"]
}
{
"symbol": "NFA",
"name": "Non Fungible Aymeric",
"description": "Token representing Aymeric",
"decimals": "0",
"isBooleanAmount": true,
"artifactUri": "link to the tokenised object",
"thumbnailUri": "logo of theNFT",
"minter": "aymeric",
"interfaces": ["TZIP-007-2021-04-17", "TZIP-016-2021-04-17", "TZIP-21"]
{
"version": "foo.1.4.2",
"license": { "name": "ISC" },
"authors": [ "Seb Mondet <seb@mondet.org>" ],
"source": {
"tools": ["SmartPy dev-20201031", "Flextesa 20200921"],
"location": "https://gitlab.com/smondet/fa2-smartpy/-/blob/c05d8ff0/multi_asset.py"
},
"interfaces": [ "TZIP-012" ],
"errors":[
{
"symbol": "AYM5",
"name": "AymericToken",
"decimals": "0",
"description": "token representing aymeric",
"authors": ["aymeric"],
"interfaces": ["TZIP-007-2021-04-17", "TZIP-016-2021-04-17"]
}
@aymericdelab
aymericdelab / export_and_evaluate_azure_tfestimator_model.py
Last active October 17, 2019 14:52
export your saved model from azure to local computer and evaluate its accuracy on the test set
#imports
import json
import numpy as np
from tensorflow.contrib import predictor
## transfer the saved model from azure blob storage to your local computer
ds = ws.get_default_datastore()
ds.download(target_path='outputs',
prefix='founder-classifier/outputs/model',
@aymericdelab
aymericdelab / azure_launch_training.py
Created October 17, 2019 14:40
create your estimator and submit it to Azure for training
from azureml.train.dnn import TensorFlow
datastore = ws.get_default_datastore()
script_params = {
'--data-folder': datastore.as_mount(),
'--batch-size': 32,
'--learning-rate': 0.001,
'--prefix': 'founder-classifier',
'--steps': 1000
# deployment as an endpoint on a SageMaker instance
predictor = estimator.deploy(initial_instance_count=1,
instance_type='ml.p2.xlarge',
endpoint_name='founder-classifier-endpoint')
# image should be an array of dimension [-1,28,28,1] and type float64 as specified in our serving_input_fn
predictor.predict({'x': image})
# don't forget to delete your endpoint when you're finished using it
@aymericdelab
aymericdelab / launch_training.py
Created October 17, 2019 12:07
launch training on sagemaker
from sagemaker import get_execution_role
from sagemaker.tensorflow import TensorFlow
role=get_execution_role()
estimator = TensorFlow(entry_point='aws_entry_point.py',
role=role,
training_steps=1000,
train_instance_count=1,
train_instance_type='ml.p2.xlarge',
import sagemaker
bucket = sagemaker.Session().default_bucket()
prefix = 'founder-classifier/data'
train_response = sagemaker.Session().upload_data(path='data/train.json',
bucket=bucket,
key_prefix=prefix)
@aymericdelab
aymericdelab / split_and_store_images_in_json.py
Created October 17, 2019 11:53
split train and test set and store into json
from sklearn.model_selection import train_test_split
import cv2
import json
import numpy as np
def images_to_json(prefix):
founders=[
{'name': 'Bill Gates',