def __init__(self): super().__init__() self.ui = mainwindow.Ui_Frec() self.ui.setupUi(self) self.db = MongoDatabase() self.init_frec()
def __init__(self): logging.info('Initialized {}'.format(self.__class__.__name__)) # instantiate database self.db = MongoDatabase() # set utf8 encoding reload(sys) sys.setdefaultencoding('utf8')
def __init__(self): logging.info('Initialized {}'.format(self.__class__.__name__)) # instantiate database self.db = MongoDatabase() # location to store plots self.plot_save_folder = os.path.join('files', 'plots') # location to store tables to self.table_save_folder = os.path.join('files', 'tables')
def __init__(self): super().__init__() self.ui = mainwindow.Ui_Frec() self.ui.setupUi(self) self.db = MongoDatabase() self.init_frec() self.is_local_save = False self.dirs = config.Dirs() self.setWindowIcon(QIcon(self.dirs.appicon))
return """ Script starts here """ if __name__ == "__main__": # create logging to console set_logger() logging.info('Start: {} '.format(__file__)) # create database connection db = MongoDatabase() # name of collection to store all the training tweets to db_collection = 'training_tweets' # location to save machine learning classification models to model_save_location = os.path.join('files', 'ml_models2') # get all the training tweet documents D = db.read_collection(collection=db_collection) # get values from list and assign to X and Y X, Y = zip(*[(x['text'], str(x['label'])) for x in D]) # define pipeline options pipeline_setup = get_pipeline_setup()
def __init__(self): self.components = [] self.database = MongoDatabase("localhost") self.load_components()
# Specify the port number. PORT = 1496 # Directory to save videos to. ROOT_DIR = os.getcwd() SAVE_DIR = f'{os.getcwd()}/videos' # Create the server. app = Flask(__name__) api = Api(app) valid_headers = ['Content-Type', 'Access-Control-Allow-Origin', '*'] cors = CORS(app, allow_headers=valid_headers) # Connect to the database. mongo = MongoDatabase() # Video processing. processor = Processor() # Do a little server-side checking. ALLOWED_EXTENSIONS = set(['webm', 'mp4', 'mp3', 'wav', 'jpeg', 'gif', 'png']) # ------------------------------------------------------------- # Global functions. def allowed_file(filename): '''Ensure we want to keep this file.''' return True
import os import database from database import MongoDatabase from config import PitConfig from routes import PitRoutes reload(sys) sys.setdefaultencoding('utf8') # ---------------------------------------------------------------------------- # # Create Flask web application object. pit_app = flask.Flask(__name__, static_url_path="") pit_app.secret_key = "roflmao" # Set up and verify database connection. database = MongoDatabase(PitConfig) database.connect() # Set up API endpoints. routes = PitRoutes(pit_app, database, PitConfig, flask.make_response, flask.render_template) if __name__ == "__main__": # Start application. debug = PitConfig['web']['debug'] == 'True' port = int(PitConfig['web']['port']) if debug: pit_app.run(debug=debug, host="0.0.0.0", port=port) else: context = ('fullchain.pem', 'privkey.pem') pit_app.run(debug=debug,
def __init__(self): logging.info('Initialized {}'.format(self.__class__.__name__)) # instantiate database self.db = MongoDatabase()
def __init__(self): self.processing_queue = deque() self.actively_processing = {} self.mongo = MongoDatabase()