Image Filtering Demo

Dear Community,

I am experiencing difficulties while attempting to run the Image Filtering source code. Despite diligently following the instructions provided here ( · zama-fhe/encrypted_image_filtering at main), I continue to encounter the following error.

Do you have any suggestions or ideas on how to resolve this issue?

Thank you.

~/encrypted_image_filtering$ python3
INFO: Started server process [55501]
INFO: Waiting for application startup.
INFO: Application startup complete.
ERROR: [Errno 98] error while attempting to bind on address (‘’, 8000): address already in use
INFO: Waiting for application shutdown.
INFO: Application shutdown complete.
Starting the demo…
Running on local URL:
user_id 1877293612
Traceback (most recent call last):
File “~/encrypted_image_filtering/.venv/lib/python3.9/site-packages/gradio/”, line 292, in run_predict
output = await app.blocks.process_api(
File “~/encrypted_image_filtering/.venv/lib/python3.9/site-packages/gradio/”, line 1007, in process_api
result = await self.call_function(fn_index, inputs, iterator, request)
File “~/encrypted_image_filtering/.venv/lib/python3.9/site-packages/gradio/”, line 848, in call_function
prediction = await anyio.to_thread.run_sync(
File “~/encrypted_image_filtering/.venv/lib/python3.9/site-packages/anyio/”, line 33, in run_sync
return await get_asynclib().run_sync_in_worker_thread(
File “~/encrypted_image_filtering/.venv/lib/python3.9/site-packages/anyio/_backends/”, line 877, in run_sync_in_worker_thread
return await future
File “~/encrypted_image_filtering/.venv/lib/python3.9/site-packages/anyio/_backends/”, line 807, in run
result =, *args)
File “~/encrypted_image_filtering/”, line 156, in keygen
client = get_client(user_id, filter_name)
File “~/encrypted_image_filtering/”, line 86, in get_client
return FHEClient(
File “~/encrypted_image_filtering/”, line 101, in init
self.client = cnp.Client.load(self.path_dir / “”, self.key_dir)
File “~/encrypted_image_filtering/.venv/lib/python3.9/site-packages/concrete/numpy/compilation/”, line 90, in load
shutil.unpack_archive(path, tmp_dir, “zip”)
File “/usr/lib/python3.9/”, line 1236, in unpack_archive
func(filename, extract_dir, **dict(format_info[2]))
File “/usr/lib/python3.9/”, line 1140, in _unpack_zipfile
raise ReadError(“%s is not a zip file” % filename)
shutil.ReadError: ~/encrypted_image_filtering/filters/blur/deployment/ is not a zip file

so this seems to be the issue:

" ~/encrypted_image_filtering/filters/blur/deployment/ is not a zip file"

Hi @aidenparker,

Thanks for reaching out to us !

I have executed the following instructions and it works for me.

python3 -m venv .venv
source .venv/bin/activate
git clone
pip3 install -r requirements.txt --ignore-installed
cd encrypted_image_filtering/
pip3 install -U pip wheel setuptools --ignore-installed
pip3 install -r requirements.txt --ignore-installed

Based on the error log you shared, I can read: ERROR: [Errno 98] error while attempting to bind on address ('', 8000): address already in use.
I had this error once, which means that this port and address are taken by a program that you launched. So, to get rid of this error, kill the associated program, if you couldn’t find the PID, restart your machine.

Let me know if you’ve solved your problem.

I also replied to your email :wink:

Thanks and regards !

Hi Celia,

Thanks for your reply!
The error you mentioned in your reply is not the issue. As you truly said, restarting the machine would solve the issue. The problem I am facing is here:

" ~/encrypted_image_filtering/filters/blur/deployment/ is not a zip file"

it seems that the “” is not recognized as a zip file.

any idea/hints?


Hello Aiden, is the final deployment app that handles client/server part. The FHE processing itself is handled by a standalone file compiled (by our FHE compiler) and packaged as a zip file (the one that you are missing, if you want to know more about this, you could read here: Deploy - Concrete).

To fix your issue you should just run the that will compile and save all availables filters as zip files and then run your server.

Thanks for the report, what @alex said should indeed fix your issue but let us know if not ! We are planning on updating these Hugging Face spaces’ dependencies soon and we’ll also invite users to re-compile the filters :wink:

Hello @aidenparker,
Good news, the image filtering space has been updated with newer versions, you should not face the issue anymore (as long as you properly upgrade the requirements) :tada:

Let us know how it goes !

Roman, Alex, and Celia,

The new version is working now! Thank you very much for your support!

The only minor issue I have with the code is that it changes the input image shape to (100, 100), which is too small for what I am using FHE for. Following the tutorial, I tried modifying the following line in the file,

INPUT_SHAPE = (100, 100, 3)

but it still resizes the image to (100, 100). Do you have any tips on how to resolve this issue?

Hello @aidenparker ,
I’ve just checked and you should normally be able to change the input shape as long as it stays squared images ! For that, you indeed need to update INPUT_SHAPE = (100, 100, 3), as you found out, but then don’t forget to run python3 before launching the app as the FHE circuits need to be re-compiled using the new shapes :wink:

Besides, you might also want to empty EXAMPLES (by writing EXAMPLES = [] in the same file) as Gradio seems to throw an error if the input examples don’t have the expected input shape. Or you can replace these examples by your own with proper shapes, as you wish :slightly_smiling_face:

Hope this helps !