Example #1
0
def add_teacher():
    data = request.json
    t_obj = teacher(name=data['name'], contact=data['contact'])
    session.add(t_obj)
    session.commit()
    session.close()
    return json.dumps({"data": "{} - Added Succesfully ".format(data['name'])})
Example #2
0
def add_teacher(request):
    if request.method == 'POST':
        form = teacherForm(request.POST)

        if form.is_valid():
            a = teacher(first_name=form.cleaned_data["first_name"],
                       last_name=form.cleaned_data["last_name"],
                       email=form.cleaned_data["email"],
                        office_details=form.cleaned_data['office_details'],
                        phone=form.cleaned_data['phone'])

            a.save()
            return HttpResponseRedirect('/all-teacher/')






    else:
        form = teacherForm()

    return render_to_response('add-teacher.html', {'form': form}, RequestContext(request))
Example #3
0
with tf.Graph().as_default(), tf.Session() as sess:

    # placeholders for training data

    phone_ = tf.placeholder(tf.float32, [None, PATCH_SIZE])
    phone_image = tf.reshape(phone_, [-1, PATCH_HEIGHT, PATCH_WIDTH, 3])

    dslr_ = tf.placeholder(tf.float32, [None, PATCH_SIZE])
    dslr_image = tf.reshape(dslr_, [-1, PATCH_HEIGHT, PATCH_WIDTH, 3])

    adv_ = tf.placeholder(tf.float32, [None, 1])

    # get processed enhanced image

    enhanced, _, _ = models.teacher(phone_image)

    # transform both dslr and enhanced images to grayscale

    enhanced_gray = tf.reshape(tf.image.rgb_to_grayscale(enhanced),
                               [-1, PATCH_WIDTH * PATCH_HEIGHT])
    dslr_gray = tf.reshape(tf.image.rgb_to_grayscale(dslr_image),
                           [-1, PATCH_WIDTH * PATCH_HEIGHT])

    # push randomly the enhanced or dslr image to an adversarial CNN-discriminator

    adversarial_ = tf.multiply(enhanced_gray, 1 - adv_) + tf.multiply(
        dslr_gray, adv_)  # if adv_ = 0, enhanced_gray
    adversarial_image = tf.reshape(adversarial_,
                                   [-1, PATCH_HEIGHT, PATCH_WIDTH, 1])
Example #4
0
with tf.Graph().as_default(), tf.Session() as sess:
    # placeholders for training data

    phone_ = tf.placeholder(tf.float32, [None, PATCH_SIZE])
    phone_image = tf.reshape(phone_, [-1, PATCH_HEIGHT, PATCH_WIDTH, 3])

    dslr_ = tf.placeholder(tf.float32, [None, PATCH_SIZE])
    dslr_image = tf.reshape(dslr_, [-1, PATCH_HEIGHT, PATCH_WIDTH, 3])

    adv_ = tf.placeholder(tf.float32, [None, 1])

    # get processed enhanced image

    enhanced, at1, at2 = models.student(phone_image)
    enhanced_teacher, at1_, at2_ = models.teacher(phone_image)

    # transform both dslr and enhanced images to grayscale

    enhanced_gray = tf.reshape(tf.image.rgb_to_grayscale(enhanced),
                               [-1, PATCH_WIDTH * PATCH_HEIGHT])
    dslr_gray = tf.reshape(tf.image.rgb_to_grayscale(dslr_image),
                           [-1, PATCH_WIDTH * PATCH_HEIGHT])

    # push randomly the enhanced or dslr image to an adversarial CNN-discriminator

    adversarial_ = tf.multiply(enhanced_gray, 1 - adv_) + tf.multiply(
        dslr_gray, adv_)  # if adv_ = 0, enhanced_gray
    adversarial_image = tf.reshape(adversarial_,
                                   [-1, PATCH_HEIGHT, PATCH_WIDTH, 1])
Example #5
0
from models import Session, teacher, student

session0 = Session()

teacher0 = teacher(teacher_id = 1, name = "Ya", email = "*****@*****.**", password = "******")
student0 = student(student_id = 1, name = "Tlumok",s_bal = 10, marks = [9,11)

session0.add(teacher0)
session0.add(student0)

session0.commit()

session0.close()

# psql -h localhost -d students_rating -U postgres -p 5432 -a -q -f create_table.sql
# python add_models.py 
# чекнути пгадмін
# alembic revision --autogenerate
# alembic upgrade head
# env LDFLAGS="-I/usr/local/opt/openssl/include -L/usr/local/opt/openssl/lib" pip install psycopg2
Example #6
0
# get all available image resolutions
res_sizes = utils.get_resolutions()

# get the specified image resolution
IMAGE_HEIGHT, IMAGE_WIDTH, IMAGE_SIZE = utils.get_specified_res(res_sizes, phone, resolution)

# disable gpu if specified
config = tf.ConfigProto(device_count={'GPU': 0}) if use_gpu == "false" else None

# create placeholders for input images
x_ = tf.placeholder(tf.float32, [None, IMAGE_SIZE])
x_image = tf.reshape(x_, [-1, IMAGE_HEIGHT, IMAGE_WIDTH, 3])

# generate enhanced image
# enhanced,_,_ = student(x_image)
enhanced,_,_ = teacher(x_image)

with tf.Session(config=config) as sess:

    test_dir = dped_dir + phone.replace("_orig", "") + "/test_data/full_size_test_images/"
    test_photos = [f for f in os.listdir(test_dir) if os.path.isfile(test_dir + f)]

    if test_subset == "small":
        # use five first images only
        test_photos = test_photos[0:5]

    if phone.endswith("_orig"):

        # load pre-trained model
        saver = tf.train.Saver()
        saver.restore(sess, "pretrained_teacher_model/teacher.ckpt")