chore: update
Browse files
app.py
CHANGED
|
@@ -336,9 +336,6 @@ def decrypt_output(user_id, filter_name):
|
|
| 336 |
well as two booleans used for resetting Gradio checkboxes
|
| 337 |
|
| 338 |
"""
|
| 339 |
-
|
| 340 |
-
print("Decrypt output ------------------------------------------------")
|
| 341 |
-
|
| 342 |
if user_id == "":
|
| 343 |
raise gr.Error("Please generate the private key first.")
|
| 344 |
|
|
@@ -364,17 +361,12 @@ def decrypt_output(user_id, filter_name):
|
|
| 364 |
|
| 365 |
|
| 366 |
def resize_img(img, width=256, height=256):
|
| 367 |
-
|
| 368 |
-
print("Reshape img before", img.shape, type(img))
|
| 369 |
if img.dtype != numpy.uint8:
|
| 370 |
img = img.astype(numpy.uint8)
|
| 371 |
-
|
| 372 |
img_pil = Image.fromarray(img)
|
| 373 |
-
print(type(img_pil))
|
| 374 |
# Resize the image
|
| 375 |
resized_img_pil = img_pil.resize((width, height))
|
| 376 |
-
print("Reshape img before", resized_img_pil.size)
|
| 377 |
-
|
| 378 |
# Convert back to a NumPy array
|
| 379 |
return numpy.array(resized_img_pil)
|
| 380 |
|
|
@@ -555,9 +547,6 @@ with demo:
|
|
| 555 |
outputs=[output_image, keygen_checkbox, send_input_checkbox],
|
| 556 |
)
|
| 557 |
|
| 558 |
-
input_image.change(fn=resize_img, inputs=input_image, outputs=input_image)
|
| 559 |
-
|
| 560 |
-
|
| 561 |
gr.Markdown(
|
| 562 |
"The app was built with [Concrete-ML](https://github.com/zama-ai/concrete-ml), a "
|
| 563 |
"Privacy-Preserving Machine Learning (PPML) open-source set of tools by [Zama](https://zama.ai/). "
|
|
|
|
| 336 |
well as two booleans used for resetting Gradio checkboxes
|
| 337 |
|
| 338 |
"""
|
|
|
|
|
|
|
|
|
|
| 339 |
if user_id == "":
|
| 340 |
raise gr.Error("Please generate the private key first.")
|
| 341 |
|
|
|
|
| 361 |
|
| 362 |
|
| 363 |
def resize_img(img, width=256, height=256):
|
| 364 |
+
"""Resize the image."""
|
|
|
|
| 365 |
if img.dtype != numpy.uint8:
|
| 366 |
img = img.astype(numpy.uint8)
|
|
|
|
| 367 |
img_pil = Image.fromarray(img)
|
|
|
|
| 368 |
# Resize the image
|
| 369 |
resized_img_pil = img_pil.resize((width, height))
|
|
|
|
|
|
|
| 370 |
# Convert back to a NumPy array
|
| 371 |
return numpy.array(resized_img_pil)
|
| 372 |
|
|
|
|
| 547 |
outputs=[output_image, keygen_checkbox, send_input_checkbox],
|
| 548 |
)
|
| 549 |
|
|
|
|
|
|
|
|
|
|
| 550 |
gr.Markdown(
|
| 551 |
"The app was built with [Concrete-ML](https://github.com/zama-ai/concrete-ml), a "
|
| 552 |
"Privacy-Preserving Machine Learning (PPML) open-source set of tools by [Zama](https://zama.ai/). "
|