예제 #1
0
파일: main.py 프로젝트: akayami/ixhack2019
from flask import Flask, render_template, request
from flask_cors import CORS
from flask_socketio import SocketIO, emit
from logger import getlogger
from settings import Settings
import nltk
from flickrapi import FlickrAPI
import sys
import timeit
import urllib.request
import json

logger = getlogger(__name__)
settings = Settings

app = Flask(__name__,
            template_folder='html/templates',
            static_folder='html/static')

CORS(app)

socketio = SocketIO(app)
app.debug = False

flickr = FlickrAPI('c6a2c45591d4973ff525042472446ca2',
                   '202ffe6f387ce29b',
                   format='parsed-json')


@app.route('/nltk', methods=['POST'])
def nltk_process():
예제 #2
0
import os, sys, pickle, gzip, json, shutil, base64
#import umsgpack

try:
    from StringIO import StringIO as BytesIO
except ImportError:
    from io import StringIO
    from io import BytesIO

from PySide.QtCore import QByteArray, QIODevice, QBuffer

from ghost import Ghost

import logging
from logger import getlogger
logger = getlogger()

appdir = os.path.abspath(
    os.path.join(os.path.dirname(__file__), "..")
)

def main(url, output, option={}):
    result = {
        "error":[],
        "page":{},
        "resources":[],
        "capture":None,
    }
    #savedir = appdir + "/artifacts/ghost/" +  output
    #dump = savedir +  "/ghost.pkl"
    savedir = os.path.join(appdir, "artifacts/ghost")
예제 #3
0
파일: main.py 프로젝트: 329tyson/KD_pytorch
    if args.fsr_enabled:
        print('Training Feature Super Resolution GAN model')
        print('\tLow resolution scaling = {} x {}'.format(args.low_ratio, args.low_ratio))

        # FSR-GAN model
        generator = FSR_Generator()
        discriminator = FSR_Discriminator()

        optimizer_G = optim.Adam(generator.parameters(), lr=args.lr)
        optimizer_D = optim.Adam(discriminator.parameters(), lr=args.lr)

        generator.cuda()
        discriminator.cuda()

        # Logger
        logger = getlogger(args.log_dir + '/FSR-GAN_{}_LOW_{}'
                           .format(args.dataset, str(args.low_ratio)))
        for arg in vars(args):
            logger.debug('{} - {}'.format(str(arg), str(getattr(args, arg))))
        logger.debug(
            '\nTraining FSR-GAN model, Low resolution of {}x{}'.format(str(args.low_ratio),
                                                                       str(args.low_ratio)))
        logger.debug('\t on ' + args.dataset.upper() + ' dataset, with hyper parameters above\n\n')

        # training_FSR(net, generator, discriminator, optimizer_G, optimizer_D, args.focal_loss_r,
                     # args.classes, args.lr, args.lr_decay, args.epochs, args.ten_batch_eval,
                     # train_loader, eval_train_loader, eval_validation_loader, num_training, num_validation,
                     # args.low_ratio, args.result, logger, args.vgg_gap, args.save)

        training_Disc(teacher_net, net, optimizer, discriminator, optimizer_D, args.w_clip,
                     args.lr, args.lr_decay, args.epochs, args.ten_batch_eval,
                     train_loader, eval_train_loader, eval_validation_loader, num_training, num_validation,
예제 #4
0
import logger

log=logger.getlogger()

log.info('jeevan')
예제 #5
0
파일: app.py 프로젝트: tuanzhang7/CMSmd5
import logger
import textfile
import time
import directmove
import xmlhelper
import os

log = logger.getlogger('mylogger')
rootdir = "/alfresco_content/OneSearch/Physical_Resources/LMS"

# rootdir = raw_input("Enter Path:")
# if len(rootdir) <= 0:
#     rootdir = "/alfresco_content/OneSearch/Physical_Resources/LMS"

print ("1. Move by Textfile")
print ("2. Move directly")
print ("3. Generate sample metadata files")
choice = raw_input("enter choice:")

if choice == "1":
    txtfile = raw_input("Enter text file:")
    if len(txtfile) <= 0:
        txtfile = "textfiles/alf_path.txt"

    start = time.time()
    counter = textfile.move_by_textfile(txtfile, rootdir)
    end = time.time()
    speed = counter / (end - start)
    log.info(txtfile + " processed :" + str(counter) + " Speed: " + str(int(speed)) + "/second")
elif choice == "2":
    start = time.time()
예제 #6
0
#encoding:utf-8

"""
Some celery tasks here

"""

import celery 
import celeryconfig 
from logger import getlogger

logger  = getlogger(__name__)
app     = celery.Celery() 
app.config_from_object(celeryconfig)

@app.task
def add(x, y):
    """
    return x + y

    """
    z = x + y
    logger.info('{} + {} = {}'.format(x, y, z))
    return 'done', z
예제 #7
0
import os, sys, pickle, gzip, json, shutil, base64
#import umsgpack

try:
    from StringIO import StringIO as BytesIO
except ImportError:
    from io import StringIO
    from io import BytesIO

from PySide.QtCore import QByteArray, QIODevice, QBuffer

from ghost import Ghost

import logging
from logger import getlogger
logger = getlogger()

appdir = os.path.abspath(os.path.join(os.path.dirname(__file__), ".."))


def main(url, output, option={}):
    result = {
        "error": [],
        "page": {},
        "resources": [],
        "capture": None,
    }
    #savedir = appdir + "/artifacts/ghost/" +  output
    #dump = savedir +  "/ghost.pkl"
    savedir = os.path.join(appdir, "artifacts/ghost")
    dump = savedir + "/" + output