Vishnu Naresh Boddeti commited on
Commit
06a7ef6
Β·
1 Parent(s): 1d2e932

initial commit

Browse files
.gitattributes CHANGED
@@ -33,3 +33,5 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
 
 
 
33
  *.zip filter=lfs diff=lfs merge=lfs -text
34
  *.zst filter=lfs diff=lfs merge=lfs -text
35
  *tfevents* filter=lfs diff=lfs merge=lfs -text
36
+ *.png filter=lfs diff=lfs merge=lfs -text
37
+ *.jpg filter=lfs diff=lfs merge=lfs -text
VGGFace2/n000001/0002_01.jpg ADDED

Git LFS Details

  • SHA256: fefd04f3c37e07951103cbd4b928b902bbb9eb9b135d91b9be8b568833522c08
  • Pointer size: 129 Bytes
  • Size of remote file: 7.11 kB
VGGFace2/n000001/0013_01.jpg ADDED

Git LFS Details

  • SHA256: 92cf5daba0697dcd1df56837512d19299f503d2ffc1e2d83adb122dfca761813
  • Pointer size: 129 Bytes
  • Size of remote file: 7.32 kB
VGGFace2/n000082/0001_02.jpg ADDED

Git LFS Details

  • SHA256: da1923031611d2ea7933b2621364c682f56818681df36d4dad61e01346e4a2bb
  • Pointer size: 129 Bytes
  • Size of remote file: 5.81 kB
VGGFace2/n000082/0003_03.jpg ADDED

Git LFS Details

  • SHA256: 771b4ed52288112cbcfd7dfe0029ba4fd3dddd8c6908a065748b045a6c2d9dc6
  • Pointer size: 129 Bytes
  • Size of remote file: 6.13 kB
VGGFace2/n000129/0001_01.jpg ADDED

Git LFS Details

  • SHA256: 6ffd30dc9050bd8e7bd5bbb558acc344c1f6637ca61bac578440bfd8c021ee58
  • Pointer size: 129 Bytes
  • Size of remote file: 6.53 kB
VGGFace2/n000129/0006_01.jpg ADDED

Git LFS Details

  • SHA256: 9d9ebb54bc813f3911dcf5ff7ac59b7c49fdf0d519d629d2c276fb87ba12be74
  • Pointer size: 129 Bytes
  • Size of remote file: 6.26 kB
VGGFace2/n000148/0014_01.jpg ADDED

Git LFS Details

  • SHA256: 383de9a536a8666c142f1947028497db8f7ea7b57d6bdcb4407cf4c01051a39b
  • Pointer size: 129 Bytes
  • Size of remote file: 5.53 kB
VGGFace2/n000148/0043_01.jpg ADDED

Git LFS Details

  • SHA256: e2b4fed09c2e7427d6b722efec7faac25e87001f4656ddf138bf32df1cc54f4a
  • Pointer size: 129 Bytes
  • Size of remote file: 6.04 kB
VGGFace2/n000149/0002_01.jpg ADDED

Git LFS Details

  • SHA256: 4c06b3c5265ee7eda7a0bc6771904b8725df344323097fa49167c4f7e4d8a50d
  • Pointer size: 129 Bytes
  • Size of remote file: 7.97 kB
VGGFace2/n000149/0019_01.jpg ADDED

Git LFS Details

  • SHA256: 920730300e5b06d303dcf81cf9b290ecc7a35f9f71c9cee8629af2adeb03de99
  • Pointer size: 129 Bytes
  • Size of remote file: 6.54 kB
VGGFace2/n000394/0007_01.jpg ADDED

Git LFS Details

  • SHA256: 20da2edff7d2497930f03c37d4d22126308bdf17f72d970a3883e2929125e318
  • Pointer size: 129 Bytes
  • Size of remote file: 6.81 kB
VGGFace2/n000394/0018_01.jpg ADDED

Git LFS Details

  • SHA256: 3a3963e0e65951aea19cc52713a32c1ea1a530027c25c357af7d016997e94091
  • Pointer size: 129 Bytes
  • Size of remote file: 6.62 kB
app.py ADDED
@@ -0,0 +1,304 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import numpy as np
3
+ from PIL import Image
4
+ import cv2
5
+ from insightface.app import FaceAnalysis
6
+ from huggingface_hub import snapshot_download
7
+ import time
8
+ import subprocess
9
+ import os
10
+
11
+ # --- Configuration ---
12
+ SECURITYLEVELS = ["128", "196", "256"]
13
+ FRMODELS = ["AuraFace-v1"]
14
+ EXAMPLE_IMAGES_ENROLL = ['./VGGFace2/n000001/0002_01.jpg', './VGGFace2/n000149/0002_01.jpg', './VGGFace2/n000082/0001_02.jpg', './VGGFace2/n000148/0014_01.jpg']
15
+ EXAMPLE_IMAGES_AUTH = ['./VGGFace2/n000001/0013_01.jpg', './VGGFace2/n000149/0019_01.jpg', './VGGFace2/n000082/0003_03.jpg', './VGGFace2/n000148/0043_01.jpg']
16
+
17
+ # --- Global Variables ---
18
+ face_app = None
19
+
20
+ # --- Helper Functions ---
21
+ def initialize_face_app():
22
+ """Initializes the FaceAnalysis model."""
23
+ global face_app
24
+ if face_app is None:
25
+ print("Initializing FaceAnalysis model...")
26
+ snapshot_download("fal/AuraFace-v1", local_dir="./models/auraface")
27
+ face_app = FaceAnalysis(name="auraface", providers=["CPUExecutionProvider"], root=".")
28
+ face_app.prepare(ctx_id=0, det_size=(128, 128))
29
+ print("FaceAnalysis model initialized.")
30
+ return face_app
31
+
32
+ def run_binary(bin_path, *args):
33
+ """Runs a compiled binary file and returns the result."""
34
+ if not os.path.isfile(bin_path):
35
+ raise gr.Error(f"Error: Compiled binary not found at {bin_path}")
36
+
37
+ command = [bin_path] + list(args)
38
+ print(f"Running command: {' '.join(command)}")
39
+
40
+ cwd = "."
41
+
42
+ try:
43
+ os.chmod(bin_path, 0o755)
44
+ start_time = time.time()
45
+ result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True, check=True, cwd=cwd)
46
+ duration = time.time() - start_time
47
+ print(f"Binary execution successful. Duration: {duration:.2f}s")
48
+ return result.stdout, duration
49
+ except subprocess.CalledProcessError as e:
50
+ print(f"Error executing binary: {e.stderr}")
51
+ raise gr.Error(f"Execution failed: {e.stderr}")
52
+ except Exception as e:
53
+ print(f"An unexpected error occurred: {e}")
54
+ raise gr.Error(f"An unexpected error occurred: {str(e)}")
55
+
56
+ def extract_embedding(image_path, mode=None):
57
+ """Extracts face embedding from an image path."""
58
+ if image_path is None:
59
+ raise gr.Error("Please upload or select an image first.")
60
+
61
+ app = initialize_face_app()
62
+
63
+ try:
64
+ pil_image = Image.open(image_path).convert("RGB")
65
+ except Exception as e:
66
+ raise gr.Error(f"Failed to open or read image file: {e}")
67
+
68
+ cv2_image = np.array(pil_image)
69
+ cv2_image = cv2_image[:, :, ::-1]
70
+ faces = app.get(cv2_image)
71
+
72
+ if not faces:
73
+ raise gr.Error("No face detected. Please try another image.")
74
+
75
+ embedding = faces[0].normed_embedding
76
+
77
+ if mode:
78
+ # For 1:1 recognition, save to the respective binary folder
79
+ if mode in ["enroll", "auth"]:
80
+ emb_path = f'./{mode}-emb.txt'
81
+ # For 1:N search, create a subject-specific path in the search folder
82
+ else: # search_enroll, search_auth
83
+ if "VGGFace2" in image_path:
84
+ subject = image_path.split('/')[-2]
85
+ else:
86
+ subject = 'uploadedSubj'
87
+ os.makedirs(f'./embeddings/{subject}', exist_ok=True)
88
+ emb_path = f'./embeddings/{subject}/{mode}-emb.txt'
89
+
90
+ np.savetxt(emb_path, embedding.reshape(1, -1), fmt="%.6f", delimiter=',')
91
+ return embedding.tolist(), emb_path
92
+
93
+ return embedding.tolist()
94
+
95
+ # --- UI Components ---
96
+ def create_image_selection_ui(label, gallery_images):
97
+ with gr.Group():
98
+ gr.HTML(f'<h3 class="step-header">{label}</h3>')
99
+ image_state = gr.State()
100
+ image_display = gr.Image(type="filepath", label="Selected Image", interactive=False)
101
+ with gr.Tabs():
102
+ with gr.TabItem("Upload"):
103
+ image_upload = gr.Image(type="filepath", label=f"Upload Image")
104
+ with gr.TabItem("Select from Gallery"):
105
+ image_gallery = gr.Gallery(value=gallery_images, columns=4, height="auto", object_fit="contain")
106
+
107
+ # Event handlers that directly update both the hidden state and the visible display
108
+ def on_select(evt: gr.SelectData):
109
+ selected_image = gallery_images[evt.index] # Get the actual image path from the gallery list
110
+ return selected_image, selected_image
111
+
112
+ def on_upload(filepath):
113
+ return filepath, filepath
114
+
115
+ image_upload.change(on_upload, inputs=image_upload, outputs=[image_state, image_display])
116
+ image_gallery.select(on_select, None, outputs=[image_state, image_display])
117
+
118
+ return image_state
119
+
120
+ # --- UI Styling and Theming ---
121
+ css = """
122
+ @import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');
123
+ :root {
124
+ --background: #EEEEEC; --background-alt: #EEEEEC; --card-bg: #FFFFFF; --card-bg-alt: rgba(255, 208, 134, 0.3);
125
+ --foreground: #222; --foreground-muted: #333; --accent-orange: rgb(255, 208, 134);
126
+ --accent-gradient: linear-gradient(90deg, var(--accent-orange) 0%, #333333 100%);
127
+ --font-sans: 'Inter', Arial, Helvetica, sans-serif; --gray-333: #333333;
128
+ }
129
+ body, .gradio-container { background: var(--background); color: var(--foreground); font-family: var(--font-sans); font-size: 16px; line-height: 1.6; }
130
+ .main-header { padding: 1rem; text-align: center; margin-bottom: 2rem; background: var(--gray-333); color: var(--background); border-radius: 15px; }
131
+ .main-header h1 { font-size: 2.5rem; font-weight: 700; color: var(--accent-orange); margin:0; }
132
+ .main-header p { font-size: 1.1rem; opacity: 0.9; margin: 0.5rem 0 0 0; }
133
+ .main-header a { color: var(--background); text-decoration: none; background: transparent; padding: 0.6rem 1.5rem; border-radius: 25px; border: 1px solid var(--accent-orange); font-weight: 500; transition: all 0.3s ease; display: inline-block; margin-top: 1rem; }
134
+ .main-header a:hover { background: var(--accent-orange); color: var(--gray-333); }
135
+ .section-header { text-align: center; margin: 2rem 0; padding: 0 1rem; }
136
+ .section-header h1 { color: var(--foreground); font-size: 2.2rem; font-weight: 600; margin-bottom: 0.5rem; }
137
+ .section-header h2 { color: var(--foreground-muted); font-size: 1.5rem; font-weight: 400; margin: 0; }
138
+ .narrative-section { background: var(--card-bg); border-top: 4px solid var(--accent-orange); padding: 2rem; margin: 1.5rem 0; border-radius: 12px; box-shadow: 0 4px 15px rgba(0,0,0,0.05); }
139
+ .narrative-header { color: var(--foreground); margin: 0 0 1.5rem 0; font-size: 1.8rem; font-weight: 600; }
140
+ .step-header { color: var(--foreground); margin: 0 0 1.5rem 0; font-size: 1.3rem; font-weight: 600; }
141
+ .info-card { background: var(--card-bg-alt); border: 1px solid var(--accent-orange); border-radius: 12px; padding: 1.5rem; margin: 1.5rem 0; }
142
+ .info-card h3 { color: var(--foreground); margin: 0 0 1rem 0; font-size: 1.3rem; font-weight: 600; }
143
+ .info-card p { margin: 0 0 1rem 0; color: var(--foreground-muted); line-height: 1.6; }
144
+ .warning-card { background: #ffebee; border: 1px solid #c62828; border-radius: 12px; padding: 1.5rem; margin: 1.5rem 0; }
145
+ .warning-card h3 { color: #c62828; margin: 0 0 1rem 0; font-size: 1.3rem; font-weight: 600; }
146
+ .warning-card p { margin: 0; color: #424242; line-height: 1.6; }
147
+ .result-container { padding: 2rem; border-radius: 15px; text-align: center; margin-top: 1rem; color: white; }
148
+ .result-container h2 { margin: 0 0 0.5rem 0; font-size: 2rem; font-weight: 600; color: white; }
149
+ .result-container p { margin: 0; opacity: 0.95; font-size: 1rem; }
150
+ .match-verified { background: linear-gradient(135deg, #4caf50 0%, #45a049 100%); }
151
+ .no-match { background: linear-gradient(135deg, #f44336 0%, #d32f2f 100%); }
152
+ .icon-lock { font-size: 4rem; margin: 1rem; }
153
+ .status-text { font-size: 1.1rem; color: var(--foreground-muted); margin-top: 1rem; }
154
+ """
155
+
156
+ # --- Gradio UI Definition ---
157
+ with gr.Blocks(css=css) as demo:
158
+ # --- Header ---
159
+ gr.HTML("""
160
+ <div class="main-header">
161
+ <img src="./static/logo.png" alt="Suraksh.AI Logo" style="height: 60px; margin-bottom: 1rem;">
162
+ <h1>Suraksh AI</h1>
163
+ <p style="color: #EEEEEC; opacity: 0.9;">The Future of Secure Biometrics</p>
164
+ <a href="https://suraksh.ai/" target="_blank">🌐 Visit Our Website</a>
165
+ </div>
166
+ """)
167
+
168
+ # --- Main Tabs for Demo Mode ---
169
+ with gr.Tabs() as mode_tabs:
170
+ # --- 1:1 Recognition Demo ---
171
+ with gr.TabItem("πŸ‘οΈ Face Recognition (1:1)"):
172
+ gr.HTML("""<div class="section-header"><h1>Is this the same person?</h1><h2>A one-to-one verification demo.</h2></div>""")
173
+
174
+ with gr.Tabs():
175
+ # --- Vulnerable System Tab ---
176
+ with gr.TabItem("🚨 The Vulnerable System"):
177
+ with gr.Group(elem_classes="narrative-section"):
178
+ gr.HTML('<h2 class="narrative-header">The Problem: How Your Face Can Be Stolen</h2>')
179
+ gr.HTML("""<div class="warning-card"><h3>⚠️ Your Biometric Data is Exposed!</h3><p>Most systems handle biometric data in plaintext. This means your facial embeddingβ€”a digital map of your faceβ€”can be stolen and used to reconstruct your image, creating a major privacy risk.</p></div>""")
180
+ with gr.Row():
181
+ with gr.Column():
182
+ vuln_image_in = create_image_selection_ui("1. Select an Image", EXAMPLE_IMAGES_ENROLL)
183
+ with gr.Column():
184
+ gr.HTML('<h3 class="step-header">2. Reconstruct the Face</h3><p>Click below to simulate an attacker stealing the embedding and recreating the face.</p>')
185
+ reconstruct_btn = gr.Button("😱 Reconstruct My Face!", variant="stop")
186
+ vuln_image_out = gr.Image(type="filepath", label="Reconstructed Face", interactive=False)
187
+
188
+ reconstruct_btn.click(lambda x: "./static/reconstructed.png" if x else None, inputs=vuln_image_in, outputs=vuln_image_out)
189
+
190
+ # --- Secure System Tab ---
191
+ with gr.TabItem("βœ… The Suraksh.AI Solution"):
192
+ with gr.Group(elem_classes="narrative-section"):
193
+ gr.HTML('<h2 class="narrative-header">The Solution: Verification with FHE</h2>')
194
+ gr.HTML("""<div class="info-card"><h3>The Locked Box Analogy</h3><p>With Suraksh.AI, your biometric data is encrypted inside a "locked box" before it ever leaves your device. We can perform the verification on the encrypted data without ever seeing your real face. It's mathematically impossible for us to decrypt it.</p></div>""")
195
+
196
+ with gr.Row():
197
+ with gr.Column():
198
+ rec_ref_img = create_image_selection_ui("1. Provide Reference Image", EXAMPLE_IMAGES_ENROLL)
199
+ with gr.Column():
200
+ rec_probe_img = create_image_selection_ui("2. Provide Probe Image", EXAMPLE_IMAGES_AUTH)
201
+
202
+ with gr.Accordion("Advanced Settings", open=False):
203
+ rec_threshold = gr.Slider(-512*5, 512*5, value=133, label="Match Strictness", info="A higher value means a stricter match is required.")
204
+ rec_sec_level = gr.Dropdown(SECURITYLEVELS, value="128", label="Security Level")
205
+
206
+ rec_run_btn = gr.Button("πŸš€ Perform Secure 1:1 Match", variant="primary", size="lg")
207
+
208
+ rec_status = gr.HTML(elem_classes="status-text")
209
+ rec_result = gr.HTML()
210
+
211
+ def secure_recognition_flow(ref_img, probe_img, threshold, sec_level):
212
+ yield "Initializing...", ""
213
+ bin_path = "./bin/genKeys.bin"
214
+ run_binary(bin_path, sec_level, "genkeys")
215
+ yield "βœ… Keys Generated... Encrypting Reference...", ""
216
+ _, _ = extract_embedding(ref_img, "enroll")
217
+ run_binary("./bin/encReference.bin", sec_level, "encrypt")
218
+ yield "βœ… Reference Encrypted... Encrypting Probe...", ""
219
+ _, _ = extract_embedding(probe_img, "auth")
220
+ run_binary("./bin/encProbe.bin", sec_level, "encrypt")
221
+ yield "βœ… Probe Encrypted... Performing Secure Match...", ""
222
+ run_binary("./bin/recDecision.bin", sec_level, "decision", str(threshold))
223
+ yield "βœ… Match Computed... Decrypting Result...", ""
224
+ output, _ = run_binary("./bin/decDecision.bin", sec_level, "decision")
225
+ if "match" in output.lower():
226
+ result_html = """<div class="result-container match-verified"><h2>βœ… MATCH VERIFIED</h2><p>Identity successfully confirmed under FHE.</p></div>"""
227
+ else:
228
+ result_html = """<div class="result-container no-match"><h2>❌ NO MATCH</h2><p>Identity verification failed.</p></div>"""
229
+ yield "Done!", result_html
230
+
231
+ rec_run_btn.click(
232
+ fn=secure_recognition_flow,
233
+ inputs=[rec_ref_img, rec_probe_img, rec_threshold, rec_sec_level],
234
+ outputs=[rec_status, rec_result]
235
+ )
236
+
237
+ # --- 1:N Search Demo ---
238
+ with gr.TabItem("πŸ” Face Search (1:N)"):
239
+ gr.HTML("""<div class="section-header"><h1>Who is this person?</h1><h2>A one-to-many search demo against an encrypted database.</h2></div>""")
240
+
241
+ with gr.Tabs():
242
+ # --- Secure System Tab ---
243
+ with gr.TabItem("βœ… The Suraksh.AI Solution"):
244
+ with gr.Group(elem_classes="narrative-section"):
245
+ gr.HTML('<h2 class="narrative-header">Building and Searching a Secure Database</h2>')
246
+ gr.HTML("""<div class="info-card"><h3>From Verification to Identification</h3><p>This demo shows how FHE can be used to search for a person in a database without ever decrypting the database itself. This is ideal for large-scale, privacy-preserving identification systems.</p></div>""")
247
+
248
+ with gr.Row():
249
+ with gr.Column():
250
+ search_enroll_img = create_image_selection_ui("1. Enroll Subjects into DB", EXAMPLE_IMAGES_ENROLL)
251
+ search_offset = gr.Number(label="Subject Offset ID", info="A unique ID for this person in the DB.", precision=0)
252
+ search_enroll_btn = gr.Button("βž• Encrypt & Add to Database", variant="secondary")
253
+ search_enroll_status = gr.HTML()
254
+ with gr.Column():
255
+ search_probe_img = create_image_selection_ui("2. Search for a Subject", EXAMPLE_IMAGES_AUTH)
256
+ search_run_btn = gr.Button("πŸš€ Perform Secure 1:N Search", variant="primary", size="lg")
257
+ search_status = gr.HTML(elem_classes="status-text")
258
+
259
+ search_result = gr.HTML()
260
+
261
+ with gr.Accordion("Advanced Settings", open=False):
262
+ search_threshold = gr.Slider(-512*5, 512*5, value=133, label="Match Strictness")
263
+ search_sec_level = gr.Dropdown(SECURITYLEVELS, value="128", label="Security Level")
264
+
265
+ demo.load(lambda: run_binary("./bin/search.bin", "128", "genkeys"), None, None)
266
+
267
+ def secure_enroll_flow(image, offset, sec_level):
268
+ if image is None or offset is None: raise gr.Error("Please provide an image and a unique offset ID.")
269
+ yield "Encrypting and adding subject..."
270
+ _, emb_path = extract_embedding(image, "search_enroll")
271
+ run_binary("./bin/search.bin", sec_level, "encRef", emb_path, str(int(offset)))
272
+ run_binary("./bin/search.bin", sec_level, "addRef")
273
+ yield f"βœ… Subject with ID {int(offset)} added to the secure database."
274
+
275
+ def secure_search_flow(image, threshold, sec_level):
276
+ if image is None: raise gr.Error("Please provide an image to search.")
277
+ yield "Initializing secure search...", ""
278
+ _, emb_path = extract_embedding(image, "search_auth")
279
+ run_binary("./bin/search.bin", sec_level, "encProbe", emb_path)
280
+ yield "βœ… Probe encrypted... Searching database...", ""
281
+ run_binary("./bin/search.bin", sec_level, "search")
282
+ yield "βœ… Search complete... Decrypting results...", ""
283
+ output, _ = run_binary("./bin/search.bin", sec_level, "decDecisionClear", str(threshold))
284
+ if "found" in output.lower():
285
+ result_html = """<div class="result-container match-verified"><h2>βœ… SUBJECT FOUND</h2><p>The subject was successfully found in the database.</p></div>"""
286
+ else:
287
+ result_html = """<div class="result-container no-match"><h2>❌ NOT FOUND</h2><p>The subject was not found in the database.</p></div>"""
288
+ yield "Done!", result_html
289
+
290
+ search_enroll_btn.click(
291
+ fn=secure_enroll_flow,
292
+ inputs=[search_enroll_img, search_offset, search_sec_level],
293
+ outputs=[search_enroll_status]
294
+ )
295
+
296
+ search_run_btn.click(
297
+ fn=secure_search_flow,
298
+ inputs=[search_probe_img, search_threshold, search_sec_level],
299
+ outputs=[search_status, search_result]
300
+ )
301
+
302
+ # --- Launch the Application ---
303
+ if __name__ == "__main__":
304
+ demo.launch()
bin/decDecision.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:f7675db4cd1c61743d73b78364ccefa313b408b09713e3b16e19f5a6eee087bb
3
+ size 8045152
bin/encProbe.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:3959987099fb521134b6c46c367b2b6f6106bf9bb45eda98108e26710376f078
3
+ size 8030536
bin/encReference.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:6705fbd4703ab2bc52d4af5719f5ece369de22d214dda966b124a85803c3a92d
3
+ size 8069184
bin/genKeys.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:30c5e81854404a40c06ac9b727a17907536b1490defb055831921022b25e6e7c
3
+ size 8079376
bin/recDecision.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:97d6a8be345463779f296ae73c70a082ea90e2c41add0f99f6875d75ff753c75
3
+ size 8057936
bin/search.bin ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:179c1865afefee41d161bf77a4cd45d18becbd8d47d8c3bb16b6fd5d006c6093
3
+ size 8294280
lookupTables/Borders_nB_3_dimF_512.txt ADDED
@@ -0,0 +1 @@
 
 
1
+ -0.050880,-0.029846,-0.014102,-0.000000,0.014102,0.029846,0.050880
lookupTables/MFIP_nB_3_dQ_0.001_dimF_512.txt ADDED
@@ -0,0 +1,8 @@
 
 
 
 
 
 
 
 
 
1
+ 5,3,2,1,-1,-2,-3,-5
2
+ 3,2,1,0,0,-1,-2,-3
3
+ 2,1,0,0,0,0,-1,-2
4
+ 1,0,0,0,0,0,0,-1
5
+ -1,0,0,0,0,0,0,1
6
+ -2,-1,0,0,0,0,1,2
7
+ -3,-2,-1,0,0,1,2,3
8
+ -5,-3,-2,-1,1,2,3,5
requirements.txt ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ gradio
2
+ opencv-python
3
+ pillow
4
+ insightface
5
+ onnxruntime
6
+ numpy
7
+ huggingface_hub
static/.DS_Store ADDED
Binary file (6.15 kB). View file
 
static/logo.png ADDED

Git LFS Details

  • SHA256: efd99a8849fa7f655c6bb3559d8d8866d1eb066e86587b39f9976cd99bbd6e28
  • Pointer size: 131 Bytes
  • Size of remote file: 821 kB
static/original.jpg ADDED

Git LFS Details

  • SHA256: 1cdb04864584242755b9bf7a9397e7b3a1587fd1349e853942cec4b3e661de3c
  • Pointer size: 129 Bytes
  • Size of remote file: 5.81 kB
static/reconstructed.png ADDED

Git LFS Details

  • SHA256: dee0cc9b2a445d67394bc5fe9a573d3825a6233bc24db346876cf22084e4be7e
  • Pointer size: 130 Bytes
  • Size of remote file: 21.4 kB