tagny commited on
Commit
a1cf584
1 Parent(s): 9fdead5

team14: image filtering version working on local PC

Browse files
Files changed (3) hide show
  1. README.md +4 -4
  2. requirements.txt +1 -0
  3. server.py +8 -5
README.md CHANGED
@@ -1,5 +1,5 @@
1
  ---
2
- title: Image Filtering On Encrypted Data Using Fully Homomorphic Encryption
3
  emoji: 📸 🌄
4
  colorFrom: purple
5
  colorTo: purple
@@ -9,14 +9,14 @@ app_file: app.py
9
  pinned: true
10
  tags: [FHE, PPML, privacy, privacy preserving machine learning, image processing,
11
  homomorphic encryption, security]
12
- python_version: 3.8.16
13
  ---
14
 
15
- # Image filtering using FHE
16
 
17
  ## Run the application on your machine
18
 
19
- In this directory, ie `image_filtering`, you can do the following steps.
20
 
21
  ### Install dependencies
22
 
 
1
  ---
2
+ title: Biometric-image matching On Encrypted Data Using Fully Homomorphic Encryption
3
  emoji: 📸 🌄
4
  colorFrom: purple
5
  colorTo: purple
 
9
  pinned: true
10
  tags: [FHE, PPML, privacy, privacy preserving machine learning, image processing,
11
  homomorphic encryption, security]
12
+ python_version: 3.10.13
13
  ---
14
 
15
+ # Biometric image matching using FHE
16
 
17
  ## Run the application on your machine
18
 
19
+ In this directory, ie `team14`, you can do the following steps.
20
 
21
  ### Install dependencies
22
 
requirements.txt CHANGED
@@ -1,2 +1,3 @@
1
  concrete-ml==1.1.0
2
  gradio
 
 
1
  concrete-ml==1.1.0
2
  gradio
3
+ more_itertools
server.py CHANGED
@@ -10,9 +10,11 @@ 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.
18
 
@@ -30,10 +32,11 @@ def get_server_file_path(name, user_id, filter_name):
30
  # Initialize an instance of FastAPI
31
  app = FastAPI()
32
 
 
33
  # Define the default route
34
  @app.get("/")
35
  def root():
36
- return {"message": "Welcome to Your Image FHE Filter Server!"}
37
 
38
 
39
  @app.post("/send_input")
@@ -46,7 +49,7 @@ def send_input(
46
  # Retrieve the encrypted input image and the evaluation key paths
47
  encrypted_image_path = get_server_file_path("encrypted_image", user_id, filter)
48
  evaluation_key_path = get_server_file_path("evaluation_key", user_id, filter)
49
-
50
  # Write the files using the above paths
51
  with encrypted_image_path.open("wb") as encrypted_image, evaluation_key_path.open(
52
  "wb"
@@ -66,9 +69,9 @@ def run_fhe(
66
  evaluation_key_path = get_server_file_path("evaluation_key", user_id, filter)
67
 
68
  # Read the files using the above paths
69
- with encrypted_image_path.open("rb") as encrypted_image_file, evaluation_key_path.open(
70
  "rb"
71
- ) as evaluation_key_file:
72
  encrypted_image = encrypted_image_file.read()
73
  evaluation_key = evaluation_key_file.read()
74
 
 
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")
14
+ for filter in AVAILABLE_FILTERS
15
  }
16
 
17
+
18
  def get_server_file_path(name, user_id, filter_name):
19
  """Get the correct temporary file path for the server.
20
 
 
32
  # Initialize an instance of FastAPI
33
  app = FastAPI()
34
 
35
+
36
  # Define the default route
37
  @app.get("/")
38
  def root():
39
+ return {"message": "Welcome to Your biometric image matching!"}
40
 
41
 
42
  @app.post("/send_input")
 
49
  # Retrieve the encrypted input image and the evaluation key paths
50
  encrypted_image_path = get_server_file_path("encrypted_image", user_id, filter)
51
  evaluation_key_path = get_server_file_path("evaluation_key", user_id, filter)
52
+
53
  # Write the files using the above paths
54
  with encrypted_image_path.open("wb") as encrypted_image, evaluation_key_path.open(
55
  "wb"
 
69
  evaluation_key_path = get_server_file_path("evaluation_key", user_id, filter)
70
 
71
  # Read the files using the above paths
72
+ with encrypted_image_path.open(
73
  "rb"
74
+ ) as encrypted_image_file, evaluation_key_path.open("rb") as evaluation_key_file:
75
  encrypted_image = encrypted_image_file.read()
76
  evaluation_key = evaluation_key_file.read()
77