File size: 1,707 Bytes
c27c2c1
21c7197
 
c27c2c1
21c7197
c27c2c1
21c7197
c27c2c1
21c7197
 
 
 
c27c2c1
 
 
21c7197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
d07e70b
21c7197
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
---
title: Image Filtering on Encrypted Images using FHE
emoji: 🥷💬
colorFrom: yellow
colorTo: yellow
sdk: gradio
sdk_version: 3.2
app_file: app.py
pinned: true
tags: [FHE, PPML, privacy, privacy preserving machine learning, homomorphic encryption,
  security]
python_version: 3.8.15
---

Check out the configuration reference at https://huggingface.co/docs/hub/spaces-config-reference

# Image filtering using FHE

## Running the application on your machine

In this directory, ie `image_filtering`, you can do the following steps.

### Do once

First, create a virtual env and activate it:

<!--pytest-codeblocks:skip-->

```bash
python3 -m venv .venv
source .venv/bin/activate
```

Then, install required packages:

<!--pytest-codeblocks:skip-->

```bash
pip3 install pip --upgrade
pip3 install -U pip wheel setuptools --ignore-installed
pip3 install -r requirements.txt --ignore-installed
```

If not on Linux, or if you want to compile the FHE filters by yourself:

<!--pytest-codeblocks:skip-->

```bash
python3 compile.py
```

Check it finish well (with a "Done!").

It is also possible to manually add some new filters in `filters.py`. Yet, in order to be able to use
them interactively in the app, you first need to update the `AVAILABLE_FILTERS` list found in `common.py`
and then compile them by running :

<!--pytest-codeblocks:skip-->

```bash
python3 generate_dev_filters.py
```

## Run the following steps each time you relaunch the application

In a terminal, run:

<!--pytest-codeblocks:skip-->

```bash
source .venv/bin/activate
python3 app.py
```

## Interacting with the application

Open the given URL link (search for a line like `Running on local URL:  http://127.0.0.1:8888/`).