Deploy
deploy
UAIModal
applyAppImage()
Run this when you are finished with the image and want to apply it to the app.
copyLocalDirectories(directories=[])
Copy local directories to the specified image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directories |
list
|
List of directories to copy. Defaults to an empty list. Each item is a list containing: - 'inputPath'[0] (str): The path of the directory to copy. - 'outputPath'[1] (str): The path where the directory will be copied to. If not provided, the directory will be copied to the root directory of the image. |
[]
|
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with the copied directories. |
copyLocalFileAndDirectories(items=[])
Copies local directories to the image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
paths |
list
|
A list of directories to copy. Each item is a list containing: - 'inputPath'[0] (str): The path of the directory to copy. - 'outputPath'[1] (str): The path where the directory will be copied to. If not provided, the directory will be copied to the root directory of the image. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with the copied directories. |
copyLocalFiles(files=[])
Copy local files and directories to the specified image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
files |
list
|
A list of files and directories to be copied. Defaults to an empty list. Each item is a list containing: - 'inputPath'[0] (str): The path of the directory to copy. - 'outputPath'[1] (str): The path where the directory will be copied to. If not provided, the directory will be copied to the root directory of the image. |
[]
|
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with the copied files and directories. |
downloadFile(url, outputPath)
Downloads a file from the specified URL and saves it to the specified output path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
url |
str
|
The URL of the file to download. |
required |
outputPath |
str
|
The path to save the downloaded file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with the downloaded file. |
getDictValue(dictionary, key, defaultValue=None)
Retrieves the value associated with the given key from the dictionary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dictionary |
dict
|
The dictionary to retrieve the value from. |
required |
key |
str
|
The key to look for in the dictionary. |
required |
defaultValue |
object
|
The default value to return if the key is not found. Defaults to None. |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
object |
The value associated with the key if found, otherwise the defaultValue. |
installAWS()
Installs the AWS Boto3 library in the given image.
installCMake()
Installs CMake and dlib on the given image.
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with CMake and dlib installed. |
installCuda12_4()
Installs CUDA 12.4 on the specified image.
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The modified image with CUDA 12.4 installed. |
installFFMPEG()
Installs FFMPEG and required libraries in the given Docker image.
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The modified Docker image with FFMPEG installed. |
installFirebase(serviceFile)
Installs Firebase and copies the service account file to the image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
serviceFile |
str
|
The path to the service account file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with Firebase installed. |
installFlask()
Installs Flask and Flask-Cors packages in the given image.
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with the packages installed. |
installGitModule(gitUrl, outputPath='/root')
Clones a git repository from the specified URL and copies its contents to the specified output path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
gitUrl |
str
|
The URL of the git repository to clone. |
required |
outputPath |
str
|
The path where the cloned repository contents will be copied to. Defaults to "/root". |
'/root'
|
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image object after the installation. |
installMediaPipe()
Installs the MediaPipe library.
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The input image. |
installMoviePy()
Installs the MoviePy library in the given image.
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with MoviePy installed. |
installOpenCV()
Installs OpenCV and its dependencies on the provided image.
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with OpenCV installed. |
installPythonRequirementsLocal(localPath='requirements.txt')
Installs Python requirements from a given file into the specified Docker image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
localPath |
str
|
The path to the requirements file on the local machine. Defaults to "requirements.txt". |
'requirements.txt'
|
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated Docker image with the requirements installed. |
installPythonRequirementsServer(serverPath='/root/requirements.txt')
Installs Python requirements from a given requirements.txt file on the server.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
serverPath |
str
|
The path to the requirements.txt file on the server. Defaults to "/root/requirements.txt". |
'/root/requirements.txt'
|
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated Docker image with the installed requirements. |
installPytorch(cudaVersion=12.4, customCommand='')
Installs PyTorch with the specified CUDA version or a custom command.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cudaVersion |
int
|
The CUDA version to use for the installation. Default is 12.4. |
12.4
|
customCommand |
str
|
A custom command to use for the installation. If provided, this will override the CUDA version. |
''
|
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with PyTorch installed. |
installUAIDiffusers()
Installs the UAIDiffusers library.
installUtils()
Install necessary utilities in the given image.
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with utilities installed. |
makeDirectories(directories=[])
Make directories in the specified image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
directories |
list
|
List of directories to copy. Defaults to an empty list |
[]
|
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with the copied directories. |
runFunctions(functions=[])
Runs a list of functions on the given image.
functions (list): A list of dictionaries representing the functions to be run. Each dictionary should contain the following keys: - 'gpu' (int): The number of GPUs to allocate for the function (default: None). - 'cpu' (float): The number of CPU cores to allocate for the function (default: None). - 'memory' (str): The amount of memory to allocate for the function (default: None). - 'timeout' (int): The maximum execution time for the function in seconds (default: None). - 'force_build' (bool): Whether to force the rebuild of the function's container (default: False). - 'mounts' (tuple): A tuple of mount points to be mounted inside the function's container (default: ()). - 'network_file_system' (dict): A dictionary of network file systems to be mounted inside the function's container (default: {}). - 'secrets' (list): A list of secrets to be injected into the function's container (default: []).
Returns: Image: The updated image object after running the functions.
setEnvironmentVariable(variable={'DEV': 'True'})
Sets an environment variable in the image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variable |
dict
|
A dictionary containing the environment variable to set. |
{'DEV': 'True'}
|
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with the environment variable set. |
setEnvironmentVariables(variables=[])
Sets multiple environment variables in the image.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
variables |
list
|
A list of dictionaries containing the environment variables to set. |
[]
|
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with the environment variables set. |
unzipFile(filePath, outputPath, removeOriginal=True)
Unzips a file at the specified path and saves it to the specified output path.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
filePath |
str
|
The path of the file to unzip. |
required |
outputPath |
str
|
The path to save the unzipped file. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
Image |
The updated image with the unzipped file. |
initContainer(appName='untitled', baseClass=Image.debian_slim, python_version='3.11')
Initializes a container for the given app name, base class, and Python version.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
appName |
str
|
The name of the app. Default is "untitled". |
'untitled'
|
baseClass |
Image
|
The base class for the container. Default is Image.debian_slim. |
debian_slim
|
python_version |
str
|
The Python version to use. Default is "3.11". |
'3.11'
|
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
(App, UAIModal)
|
A tuple containing the initialized app and image objects. |
initFullAppContainer(appName='untitled', python_version='3.11', firebaseServiceJson='', cudaVersion=12.4, fileDirectories=[], cmake=False, filesToDownload=[], filesToUnzip=[], gitModules=[], requirementsLocal='', requirementsServer='', postFunctions=[], pytorchCustom='', ffmpeg=True, newDirectories=[])
Initializes a full application container with the specified configurations.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
appName |
str
|
The name of the application. Defaults to "untitled". |
'untitled'
|
python_version |
str
|
The version of Python to use. Defaults to "3.11". |
'3.11'
|
firebaseServiceJson |
str
|
The path to the Firebase service JSON file. Defaults to "". |
''
|
cudaVersion |
float
|
The version of CUDA to use. Defaults to 12.4. |
12.4
|
fileDirectories |
list
|
A list of file directories to copy to the container. Defaults to []. |
[]
|
cmake |
bool
|
Whether to install CMake. Defaults to False. |
False
|
filesToDownload |
list
|
A list of files to download. Each item in the list should be a tuple containing the URL and the destination path. Defaults to []. |
[]
|
filesToUnzip |
list
|
A list of files to unzip. Each item in the list should be a tuple containing the source path and the destination path. Defaults to []. |
[]
|
gitModules |
list
|
A list of Git modules to install. Each item in the list should be a tuple containing the repository URL and the destination path. Defaults to []. |
[]
|
requirementsLocal |
str
|
The path to the local Python requirements file. Defaults to "". |
''
|
requirementsServer |
str
|
The path to the server Python requirements file. Defaults to "". |
''
|
postFunctions |
list
|
A list of functions to run after the container is initialized. Defaults to []. |
[]
|
pytorchCustom |
str
|
The path to the custom PyTorch installation. Defaults to "". |
''
|
ffmpeg |
bool
|
Whether to install FFmpeg. Defaults to True. |
True
|
newDirectories |
list
|
A list of new directories to create in the container. Defaults to []. |
[]
|
Returns:
| Name | Type | Description |
|---|---|---|
UAIModal |
UAIModal
|
The initialized UAIModal object. |
initUAIContainer(appName='untitled', python_version='3.11', firebaseServiceJson='', cudaVersion=12.4, pytorchCustom='', ffmpeg=True, newDirectories=[])
Create a new container that UAI usually uses for its applications.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
appName |
str
|
The name of the application. Defaults to "untitled". |
'untitled'
|
python_version |
str
|
The version of Python to be used in the container. Defaults to "3.11". |
'3.11'
|
firebaseServiceJson |
str
|
The path to the Firebase service account JSON file. Defaults to "". |
''
|
cudaVersion |
float
|
The version of CUDA to be installed. Defaults to 12.4. |
12.4
|
pytorchCustom |
str
|
Custom command for installing PyTorch. Defaults to "". |
''
|
ffmpeg |
bool
|
Whether to install FFMPEG. Defaults to True. |
True
|
newDirectories |
list
|
List of new directories to be created in the container. Defaults to []. |
[]
|
Returns:
| Name | Type | Description |
|---|---|---|
UAIModal |
UAIModal
|
The initialized UAIModal object. |