Esempio n. 1
0
def main():
    # Initialize global variables
    global_var.init()

    # Generate a new solution grid
    sg.generate_grid(global_var.NEW_BOARD)

    # Print formatted new solution grid
    print("\nGenerated solution grid: ")
    print_board(global_var.NEW_BOARD)

    # Strip values from solution grid to create puzzle
    pg.strip_values(global_var.NEW_BOARD)

    # Print new puzzle
    print("\nNew puzzle: ")
    print_board(global_var.NEW_BOARD)

    # Print given puzzle
    print("\nGiven puzzle: ")
    print_board(global_var.NEW_BOARD)

    # Solve given puzzle
    s.solve(global_var.NEW_BOARD)

    # Print formatted solution to given puzzle
    print("\nSolved puzzle: ")
    print_board(global_var.NEW_BOARD)
    print(s.BRANCH_DIFFICULTY_SCORE)
Esempio n. 2
0
def initialize():
    """initialize the global variable"""
    #initilize the global variable
    global_var.init()
    cf = configparser.ConfigParser()
    cf.read('main.conf')

    global_var.set_value('filename', cf.get('file', 'filename'))
    global_var.set_value('filepath', cf.get('file', 'filepath'))

    global_var.set_value('image_weight', cf.get('image', 'weight'))
    global_var.set_value('image_height', cf.get('image', 'height'))

    global_var.set_value('host', cf.get('mysql', 'host'))
    global_var.set_value('username', cf.get('mysql', 'username'))
    global_var.set_value('passwd', cf.get('mysql', 'passwd'))
    global_var.set_value('database', cf.get('mysql', 'database'))

    global_var.set_value('classnum', cf.get('dataset', 'class_num'))

    global_var.set_value('log_dir', cf.get('network', 'log_dir'))
    global_var.set_value('delta', cf.get('network', 'delta'))
    global_var.set_value('dropout', cf.get('network', 'dropout'))
    global_var.set_value('embedding_size', cf.get('network', 'embedding_size'))
    global_var.set_value('cluster_num', cf.get('network', 'cluster_num'))
    global_var.set_value('batch_size', cf.get('network', 'batch_size'))
    global_var.set_value('rnn_epoch', cf.get('network', 'rnn_epoch'))
    global_var.set_value('cnn_epoch', cf.get('network', 'cnn_epoch'))
    global_var.set_value('hidden_neural_size',
                         cf.get('network', 'hidden_neural_size'))
    global_var.set_value('hidden_layer_num',
                         cf.get('network', 'hidden_layer_num'))
    global_var.set_value('cnn_learning_rate',
                         cf.get('network', 'cnn_learning_rate'))
    global_var.set_value('rnn_learning_rate',
                         cf.get('network', 'rnn_learning_rate'))
    global_var.set_value('num_step', cf.get('network', 'num_step'))
from tkinter import *
from global_var import init
from view.login import Login

if __name__ == '__main__':
    init()
    main_window = Tk()
    Login(main_window)
    main_window.mainloop()
Esempio n. 4
0
from db import SessionLocal
from sqlalchemy.orm.session import Session
from sqlalchemy.util.langhelpers import dependencies
from fastapi import Depends, FastAPI, HTTPException, status
from fastapi.middleware.cors import CORSMiddleware
from routers import authentication, statistics, user, order, result, nlp, admin, teacher_promo
from routers.teacher_promo import get_free_qualified_teacher
import models
import schemas
from dependencies import engine, get_db
from config import custom_openapi
from fastapi.responses import HTMLResponse
from fastapi.openapi.utils import get_openapi
import global_var

global_var.init()

models.Base.metadata.create_all(bind=engine)

app = FastAPI(title="ScoreMyEssay API")
origins = ["*"]

app.add_middleware(
    CORSMiddleware,
    allow_origins=origins,
    allow_credentials=True,
    allow_methods=["*"],
    allow_headers=["*"],
)

import global_var as gvr
import global_fe as gfe
import model as mdl
import utly

print('\nStarting program...')
gvr.init()

val = utly.check()
if (val):
    print('\nDataset not found.')
    gfe.createDataset()
else:
    print('\nDataset found.')

mdl.classify()
print('\nProgram executed successfully.')