-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathmain.py
41 lines (37 loc) · 1.43 KB
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
import logging
from utils import logger
from commandParser import getUserChoices
from Data.loadDatasetFiles import loadDatasetFiles
def __init__():
# Creating log file
logging.basicConfig(filename='logger.log', level=logging.INFO)
logger('CAPRI framework started!')
# Fetching user choices
userInputs = getUserChoices()
# Checking if user wants to load a model
if (userInputs != None):
# Initializing dataset items
datasetFiles = loadDatasetFiles(userInputs['Dataset'])
logger(f'Dataset files: {datasetFiles}', 'info', True)
# Exiting the program if dataset is not found
if (datasetFiles == None):
return
# Initializing parameters
parameters = {
"fusion": userInputs['Fusion'],
"ignored": userInputs['Ignored'],
"datasetName": userInputs['Dataset'],
"evaluation": userInputs['Evaluation'],
}
logger(f'Processing parameters: {parameters}', 'info', True)
# Dynamically loading the model
module = __import__(
'Models.' + userInputs['Model'] + '.main', fromlist=[''])
selectedModule = getattr(module, userInputs['Model'] + 'Main')
# Select the 'main' class in the module
selectedModule.main(datasetFiles, parameters)
# Closing the log file
logger('CAPRI framework finished!')
else:
logger('Framework stopepd!')
__init__()