-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmain.py
30 lines (24 loc) · 942 Bytes
/
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
import json
import logging
from modules.init import load_deepfilter_model
logging.basicConfig(level=logging.INFO, format='%(asctime)s - %(levelname)s - %(message)s')
logger = logging.getLogger()
model, df_state = None, None
def lambda_handler(event, context):
logger.info(f"Event received: {json.dumps(event)}")
global model, df_state
try:
# Load model if not already loaded
if model is None or df_state is None:
model, df_state = load_deepfilter_model(model, df_state)
logger.info("DeepFilter model loaded successfully")
return {
'success': True,
'message': 'DeepFilter model loaded successfully'
}
except Exception as e:
logger.error(f"Error loading DeepFilter model: {str(e)}", exc_info=True)
return {
'success': False,
'message': f'Error loading DeepFilter model: {str(e)}'
}