-
Notifications
You must be signed in to change notification settings - Fork 6
/
rconfig.py
99 lines (87 loc) · 3.45 KB
/
rconfig.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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
import os
import logging
class RoopConfig:
"""
Configuration class for the image processing application.
"""
ROOP_ROOT_FOLDER = os.getenv('ROOT_FOLDER', '/home/roop/') # CHANGE IT!!!!!
ROOT_FOLDER = f"{ROOP_ROOT_FOLDER}api/"
"""
Root folder where is the API. API folder need to be inside of roop directory.
"""
USE_HTTPS = bool(os.getenv('USE_HTTPS', 'True'))
"""
Determines whether the application uses HTTP or HTTPS.
"""
protocol = 'https://' if USE_HTTPS else 'http://'
"""
The protocol (HTTP or HTTPS) based on the `USE_HTTPS` configuration.
"""
SERVER_URL = os.getenv('SERVER_URL', f"{protocol}roop.3dphoto.io") #CHANGE IT!!!!!
"""
The URL of the server where the file will be downloaded and the application is running.
"""
UPLOAD_FOLDER = os.getenv('UPLOAD_FOLDER', os.path.join(ROOT_FOLDER, 'upload/'))
"""
The folder where uploaded images will be stored.
Note: Files are not deleted automatically in the current implementation.
"""
FINAL_FOLDER = os.getenv('FINAL_FOLDER', os.path.join(ROOT_FOLDER, 'generated/'))
"""
The folder where the generated images will be stored.
"""
FINAL_URL_FOLDER = os.getenv('FINAL_URL_FOLDER', 'generated')
"""
The URL path for the generated images.
Note: If the `FINAL_FOLDER` path is changed, this URL path should be updated accordingly.
"""
TEMPLATE_FOLDER = os.getenv('TEMPLATE_FOLDER', os.path.join(ROOT_FOLDER, 'template/'))
"""
The folder where the template images (video files, image files) are stored.
"""
RABBITMQ_HOST = os.getenv('RABBITMQ_HOST', 'localhost')
"""
The hostname of the RabbitMQ server.
"""
RABBITMQ_QUEUE = os.getenv('RABBITMQ_QUEUE', 'image_queue')
"""
The name of the queue used for image processing jobs in RabbitMQ.
"""
LOG_FILE_WORKER = os.getenv('LOG_FILE_WORKER', 'worker.log')
"""
The filename of the log file for worker errors.
"""
LOG_FILE_UPSCALE = os.getenv('LOG_FILE_UPSCALE', 'upscale.log')
"""
The filename of the log file for upscale errors.
"""
LOGGING_LEVEL = int(os.getenv('LOGGING_LEVEL', str(logging.INFO)))
"""
The logging level for worker errors.
"""
FRAME_PROCESSOR = os.getenv('FRAME_PROCESSOR', '--frame-processor')
KEEP_FPS = os.getenv('KEEP_FPS', '--keep-fps')
KEEP_AUDIO = os.getenv('FRAME_PROCESSOR', '--keep-audio')
FRAME_MANYFACES = os.getenv('FRAME_MANYFACES', '--many-faces')
VIDEO_ENCODER = os.getenv('VIDEO_ENCODER', '--video-encoder')
VIDEO_QUALITY = os.getenv('VIDEO_QUALITY', '--video-quality')
MAX_MEMORY = os.getenv('MAX_MEMORY', '--max-memory')
EXECUTION_THREADS = os.getenv('EXECUTION_THREADS', '--execution-threads')
"""
Parameters to Roop App.
"""
ALLOWED_EXTENSIONS_IMAGES = os.getenv('ALLOWED_EXTENSIONS', ('png', 'jpg', 'jpeg'))
ALLOWED_EXTENSIONS_VIDEO = os.getenv('ALLOWED_EXTENSIONS', ('avi' 'mov' 'mp4' 'mpeg'))
MAX_FILE_SIZE_IMAGES = 10 * 1024 * 1024 # 10MB
MAX_FILE_SIZE_VIDEO = 10 * 1024 * 1024 # 10MB
"""
Extensions, size for video and images.
"""
@staticmethod
def init_app(app):
"""
Optionally perform any additional initialization tasks for the application.
Args:
app (Flask): The Flask application instance.
"""
pass