-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathconfig.py
More file actions
47 lines (36 loc) · 1.32 KB
/
config.py
File metadata and controls
47 lines (36 loc) · 1.32 KB
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
42
43
44
45
46
47
# Configuration file for Flask application
import os
class Config:
"""Base configuration"""
SECRET_KEY = os.environ.get('SECRET_KEY') or 'dev-secret-key-change-in-production'
MAX_CONTENT_LENGTH = 16 * 1024 * 1024 # 16MB max file size
UPLOAD_FOLDER = 'static/uploads'
ALLOWED_EXTENSIONS = {'png', 'jpg', 'jpeg', 'gif', 'bmp', 'webp'}
# TensorFlow Configuration
TF_CPP_MIN_LOG_LEVEL = '2' # Reduce TensorFlow logging
INTRA_OP_PARALLELISM_THREADS = 4
INTER_OP_PARALLELISM_THREADS = 4
# Model configuration
MODEL_PATH = 'model/cifar10_advanced_cnn.h5'
BATCH_SIZE = 32 # For inference
# Class Names
CLASS_NAMES = [
'0: airplane', '1: automobile', '2: bird', '3: cat', '4: deer',
'5: dog', '6: frog', '7: horse', '8: ship', '9: truck'
]
class DevelopmentConfig(Config):
"""Development configuration"""
DEBUG = True
class ProductionConfig(Config):
"""Production configuration"""
DEBUG = False
# In production, always set SECRET_KEY via environment variable
SECRET_KEY = os.environ.get('SECRET_KEY')
if not SECRET_KEY:
raise ValueError("No SECRET_KEY set for production")
# Configuration dictionary
config = {
'development': DevelopmentConfig,
'production': ProductionConfig,
'default': DevelopmentConfig
}