romanbredehoft-zama commited on
Commit
5a6dcda
•
1 Parent(s): 8559d3b

Update developement files to allow cross-platform use

Browse files
README.md CHANGED
@@ -37,15 +37,6 @@ pip3 install -r requirements.txt --ignore-installed
37
 
38
  The above steps should only be done once.
39
 
40
- ## Generate development files
41
-
42
- If you are not on Linux, you will need to re-generate the development files manually before launching the app.
43
-
44
- ```bash
45
- python3 generate_dev_filters.py
46
- ```
47
-
48
-
49
  ## Run the app
50
 
51
  In a terminal, run:
 
37
 
38
  The above steps should only be done once.
39
 
 
 
 
 
 
 
 
 
 
40
  ## Run the app
41
 
42
  In a terminal, run:
client_server_interface.py CHANGED
@@ -65,9 +65,10 @@ class FHEDev:
65
  "The model must be compiled before saving it."
66
  )
67
 
68
- # Save the circuit for the server
 
69
  path_circuit_server = self.path_dir / "server.zip"
70
- self.filter.fhe_circuit.server.save(path_circuit_server)
71
 
72
  # Save the circuit for the client
73
  path_circuit_client = self.path_dir / "client.zip"
 
65
  "The model must be compiled before saving it."
66
  )
67
 
68
+ # Save the circuit for the server, using the via_mlir in order to handle cross-platform
69
+ # execution
70
  path_circuit_server = self.path_dir / "server.zip"
71
+ self.filter.fhe_circuit.server.save(path_circuit_server, via_mlir=True)
72
 
73
  # Save the circuit for the client
74
  path_circuit_client = self.path_dir / "client.zip"
filters/black and white/deployment/client.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:428127f644d5646878a359be4bfc95e8b70ea934623ad399e31c3f6092625d03
3
  size 348
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:1afbf993edf5cdbcc73c2c9fe2bf3748b235738cfb772b849b9058d611e01bcc
3
  size 348
filters/black and white/deployment/server.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b0d1fb5e5fd6ddbcbea932724668475e65bd3f4864728a47e588f67b9cd85ea5
3
- size 5122
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7d46df3333324fefa8558766fa825adeb579b71930b390673c38783dcdc5743d
3
+ size 840
filters/blur/deployment/client.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b12d26b9c9c15c48b43d66f3d1f2d947954a8efd1d1a422ec0bb0e9931616581
3
  size 360
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c6b45511096f6da9aa73601b1372ffc42ec9272b40348d92f90427fbddff0571
3
  size 360
filters/blur/deployment/server.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:a76994735ac8a33307257521e2cbe407cc47edea4d6e781dbfd9e7cf58e026f4
3
- size 7354
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:8cc44c02ca9ee6523a35dcb1a034b7852e59a3a587dcbf2af71ca4109fc1e138
3
+ size 824
filters/identity/deployment/client.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:735f548157a2bad1f479fcdc860d5d5e824b835d96e2becfdeb0b820543c4074
3
  size 347
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56a6dd6918993c387e9cfa1f9a373fa8acd3ecee01fabae937ca9efa317335d9
3
  size 347
filters/identity/deployment/server.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:3b76234788ce7d60081bd28cad84c0266ae6fb2ad01c451b4c6a64214fae2c03
3
- size 2819
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:21c7e3b38e16ee2635989a37c4d903b40af54392c3c1b7c99553f9201c17570f
3
+ size 564
filters/inverted/deployment/client.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:735f548157a2bad1f479fcdc860d5d5e824b835d96e2becfdeb0b820543c4074
3
  size 347
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56a6dd6918993c387e9cfa1f9a373fa8acd3ecee01fabae937ca9efa317335d9
3
  size 347
filters/inverted/deployment/server.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:0166d3cae050ff5474cafc496933b9c2cf289b51e68bcf5560ac8ef7470bd1b4
3
- size 4033
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:0b6e5457007404036aa563166c42ce5a320865b10c12a7cdc64e206b9d8ead88
3
+ size 663
filters/ridge detection/deployment/client.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:980d84fc2a7990582d380e7743ec4a1b12855a9b2de6eda986c62de3662be2fb
3
  size 369
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:c84ac5a4c0e4c5d41ee349e0982706c1a0fdee59571a4e82296e7c7545afe3f6
3
  size 369
filters/ridge detection/deployment/server.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:b89745d7fdbb2e14d7429bad6b6be57765e8719fb36212431e2cd45398fe5a05
3
- size 6079
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5abaeef5ed5754490f4894a7132fd414d191f90548c2ed59c701940d9f234ee1
3
+ size 952
filters/rotate/deployment/client.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:735f548157a2bad1f479fcdc860d5d5e824b835d96e2becfdeb0b820543c4074
3
  size 347
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:56a6dd6918993c387e9cfa1f9a373fa8acd3ecee01fabae937ca9efa317335d9
3
  size 347
filters/rotate/deployment/server.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:c3945ca08421ad5557782ade1abb4f177ca850ede2ca8f8683fb503a0437263c
3
- size 3830
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:7b350fc3287b7eb7f903f66e970d77c28905398c7770351ebdcfa9d65aa019f4
3
+ size 617
filters/sharpen/deployment/client.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:f9cc2ed43f321f369cb9736bb5a4aed49898a3ba4869db248de05baa9a8d02ef
3
  size 369
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bbca169fd30d0238b2b31213b058d6b3d54b50b2bd7e12225e5f99975302b700
3
  size 369
filters/sharpen/deployment/server.zip CHANGED
@@ -1,3 +1,3 @@
1
  version https://git-lfs.github.com/spec/v1
2
- oid sha256:e7b28e2cc7a5c86f52b5e19e1be61f25ab8c7773ff43b077b261c0bb5bad409b
3
- size 7890
 
1
  version https://git-lfs.github.com/spec/v1
2
+ oid sha256:e0557c4bf8cc5816fa78d0b059fdcdd99362969754f8720094b0b7ee1fdd994f
3
+ size 876
server.py CHANGED
@@ -5,9 +5,13 @@ from typing import List
5
  from fastapi import FastAPI, File, Form, UploadFile
6
  from fastapi.responses import JSONResponse, Response
7
 
8
- from common import FILTERS_PATH, SERVER_TMP_PATH
9
  from client_server_interface import FHEServer
10
 
 
 
 
 
11
 
12
  def get_server_file_path(name, user_id, filter_name):
13
  """Get the correct temporary file path for the server.
@@ -68,8 +72,8 @@ def run_fhe(
68
  encrypted_image = encrypted_image_file.read()
69
  evaluation_key = evaluation_key_file.read()
70
 
71
- # Load the FHE server
72
- fhe_server = FHEServer(FILTERS_PATH / f"{filter}/deployment")
73
 
74
  # Run the FHE execution
75
  start = time.time()
 
5
  from fastapi import FastAPI, File, Form, UploadFile
6
  from fastapi.responses import JSONResponse, Response
7
 
8
+ from common import FILTERS_PATH, SERVER_TMP_PATH, AVAILABLE_FILTERS
9
  from client_server_interface import FHEServer
10
 
11
+ # Load the server objects related to all currently available filters once and for all
12
+ FHE_SERVERS = {
13
+ filter: FHEServer(FILTERS_PATH / f"{filter}/deployment") for filter in AVAILABLE_FILTERS
14
+ }
15
 
16
  def get_server_file_path(name, user_id, filter_name):
17
  """Get the correct temporary file path for the server.
 
72
  encrypted_image = encrypted_image_file.read()
73
  evaluation_key = evaluation_key_file.read()
74
 
75
+ # Load the FHE server related to the chosen filter
76
+ fhe_server = FHE_SERVERS[filter]
77
 
78
  # Run the FHE execution
79
  start = time.time()