Esempio n. 1
0
# DJANGO IMPORTS
from django.conf import settings

# REST_FRAMEWORK
from rest_framework import serializers

# LOCAL IMPORT
from common.utils import get_model, build_absolute_uri, filter_query
from payment.serializers import CardSerializer

# THIRD PARTY
import stripe

OrderDetail = get_model('order')
Artist = get_model('artist')
BookService = get_model('book_service')
Service = get_model('service')

stripe.api_key = settings.STRIPE_KEY


class MyDetailSerializer(serializers.ModelSerializer):
    class Meta:

        model = OrderDetail
        fields = [
            'id', 'book_by', 'full_address', 'apt_no', 'zip_code', 'state',
            'note'
        ]

Esempio n. 2
0
val_data = gluon.data.DataLoader(ImageLabelDataset(
    image_root, val_label, shuffle=False).transform_first(transform_test),
                                 batch_size=batch_size,
                                 shuffle=False,
                                 num_workers=8)

test_data = gluon.data.DataLoader(ImageLabelDataset(
    image_root, test_label, shuffle=False).transform_first(transform_test),
                                  batch_size=batch_size,
                                  shuffle=False,
                                  num_workers=8)

#model_name = 'ResNet50_v2'
#finetune_net = get_model(model_name, pretrained=True)
finetune_net = get_model(class_num=classes, ctx=ctx)
"""
with finetune_net.name_scope():
    finetune_net.output = nn.Dense(classes)
finetune_net.output.initialize(init.Xavier(), ctx = ctx)
finetune_net.collect_params().reset_ctx(ctx)
finetune_net.hybridize()
"""

trainer = gluon.Trainer(finetune_net.collect_params(), 'sgd', {
    'learning_rate': lr,
    'momentum': momentum,
    'wd': wd
})
metric = mx.metric.Accuracy()
L = gluon.loss.SoftmaxCrossEntropyLoss()
Esempio n. 3
0
from datetime import datetime

# DJANGO IMPORT

# REST IMPORT
from rest_framework.serializers import ModelSerializer, BaseSerializer
from rest_framework import serializers

# THIRD PARTY

# LOCAL IMPORT
from .utils import generate_otp, get_or_create_token
from common.models import auth_app
from common.utils import get_model, get_object

Account = get_model('account')
HairProfile = get_model('hair_profile')
Service = get_model('service')


class RegistrationSerializer(ModelSerializer):

    password = serializers.CharField(required=False,
                                     allow_blank=True,
                                     allow_null=True)

    social_id = serializers.CharField(required=False,
                                      allow_null=True,
                                      allow_blank=True)

    class Meta:
Esempio n. 4
0
# DJANGO IMPORTS
from django.conf import settings

# REST IMPORT
from rest_framework import serializers

# LOCAL IMPORT
from common.utils import get_model, filter_query
from common.models import model_app
from .utils import send_email_artist

# THIRD PARTY
import stripe

CardManagement = get_model('card_management')
Review = get_model('review')
Payment = get_model('payment')

stripe.api_key = settings.STRIPE_KEY


class CardSerializer(serializers.ModelSerializer):

    stripe_token = serializers.CharField(required=True,
                                         allow_blank=False,
                                         allow_null=False)
    number = serializers.CharField(required=False,
                                   allow_blank=True,
                                   allow_null=True)
    country = serializers.CharField(required=False,
                                    allow_blank=True,
Esempio n. 5
0
print('+' * 80)

# prepare graph and data
fog_graph, workers = get_fog_graph(hook, args.num_workers, args.num_clusters,
                                   args.shuffle_workers, args.uniform_clusters)

print('Loading data: {}'.format(paths.data_path))
X_trains, X_tests, y_trains, y_tests, meta = pkl.load(
    open(paths.data_path, 'rb'))
test_loader = get_testloader(args.dataset, args.test_batch_size)

print(fog_graph)
print('+' * 80)

# Fire the engines
model, loss_type, agg_type = get_model(args)

if args.batch_size == 0:
    args.batch_size = int(meta['batch_size'])
    print("Resetting batch size: {}...".format(args.batch_size))

print('+' * 80)

best = 0

x_ax = []
y_ax = []
l_test = []
l_mean = []
l_std = []
y_mean = []
Esempio n. 6
0
from django.contrib import admin
from .models import Account, HairProfile
from common.models import model_app
from common.utils import get_model

# Register your models here.
# admin.site.register(Account)
# admin.site.register(HairProfile)

for i in model_app:
    model = get_model(i)
    admin.site.register(model)

admin.autodiscover()
admin.site.enable_nav_sidebar = False