예제 #1
0
    def __init__(self, init_db=False):
        """
        Initializes the Restaurant Chooser Database object, which allows a user to interact with the
        database associated with the application.

        :param init_db: If true, the database will be deleted and then recreated with the default values set. 
        Set to False by default.
        """

        self._db = DatabaseAccessor()

        if (init_db):
            clear_data(
            )  # Clears all data from the app data directory, including the database file

        self._db.create_connection(
        )  # Creates a new database file if it doesn't exist)

        if (init_db):
            self._generate_initial_database_structure()
BS_4 = np.array([
    00.550, 01.083, 01.466, 01.983, 02.499, 03.083, 03.599, 04.199, 04.799,
    05.499, 06.199, 06.950, 07.750, 08.633, 09.583, 10.850, 12.483, 14.266,
    16.316
]) * 1000
WS_4 = np.array([02.566, 07.933, 13.366]) * 1000
# Final number is 18. phase at cutoff is 22.
# Time left is 18.183 - 16.316 = 1.86 seconds.
# Number of revolutions left is 7/8 = 0.875.

try:
    os.remove(Constants.DATABASE_NAME)
except OSError:
    pass

da = DatabaseAccessor()

session_id = da.increment_and_get_session_id()

for bs in BS:
    da.insert_ball_lap_times(session_id, bs)
for ws in WS:
    da.insert_wheel_lap_times(session_id, ws)

session_id = da.increment_and_get_session_id()

for bs in BS_2:
    da.insert_ball_lap_times(session_id, bs)
for ws in WS_2:
    da.insert_wheel_lap_times(session_id, ws)
예제 #3
0
 def __init__(self, *args, **kwargs):
     super().__init__(*args, **kwargs)
     self.model, self.tokenizer = load_model_and_tokenizer(config["eval"]["model_path"])
     self.database_accessor = DatabaseAccessor()