team14 / generate_deployment_files.py
tagny's picture
image pairs matching - issue on config file in server.zip
0908a41
raw
history blame
1.14 kB
from pathlib import Path
import shutil
from client_server_interface import FHEDev
from matchers import AVAILABLE_MATCHERS, Matcher
print("Generating deployment files for all available filters")
# This repository's directory
REPO_DIR = Path(__file__).parent
# This repository's main necessary folders
MATCHERS_PATH = REPO_DIR / "data/compiled_models"
for matcher_name in AVAILABLE_MATCHERS:
print("Matcher:", matcher_name, "\n")
# Create the filter instance
matcher = Matcher(matcher_name)
# Compile the model on a representative inputset
matcher.compile()
# Define the directory path associated to this filter's deployment files
deployment_path = MATCHERS_PATH / (matcher_name + "/deployment")
# Delete the deployment folder and its content if it already exists
if deployment_path.is_dir():
print("Delete the deployment folder and its content ...")
shutil.rmtree(deployment_path)
# Save the files needed for deployment
print(f"Saving the files at {deployment_path} ...")
fhe_dev_filter = FHEDev(matcher, deployment_path)
fhe_dev_filter.save()
print("Done !")