Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,37 +1,10 @@
|
|
| 1 |
import gradio as gr
|
| 2 |
-
import numpy as np
|
| 3 |
from phe import paillier
|
| 4 |
-
|
| 5 |
-
from gradio import Column
|
| 6 |
|
| 7 |
# Generate Paillier keypair
|
| 8 |
public_key, private_key = paillier.generate_paillier_keypair(n_length=1024)
|
| 9 |
|
| 10 |
-
import requests
|
| 11 |
-
import base64
|
| 12 |
-
|
| 13 |
-
def show_image():
|
| 14 |
-
try:
|
| 15 |
-
response = requests.get("https://dnasafe.io/redesign/animation.gif")
|
| 16 |
-
response.raise_for_status() # Raise an error if request fails
|
| 17 |
-
|
| 18 |
-
img_data = response.content
|
| 19 |
-
|
| 20 |
-
# Encode data as base64-encoded data_uri
|
| 21 |
-
data_uri = f"data:image/gif;base64,{base64.b64encode(img_data).decode()}"
|
| 22 |
-
|
| 23 |
-
html = (
|
| 24 |
-
"<div>"
|
| 25 |
-
f"<img src='{data_uri}' alt='image One'>"
|
| 26 |
-
+ "</div>"
|
| 27 |
-
)
|
| 28 |
-
return html
|
| 29 |
-
|
| 30 |
-
except requests.exceptions.RequestException as e:
|
| 31 |
-
print(f"Error fetching image: {e}")
|
| 32 |
-
# Handle error: return a placeholder image, text message, etc.
|
| 33 |
-
return "<div>Error: Could not display image.</div>"
|
| 34 |
-
|
| 35 |
|
| 36 |
def secure_encoding(input_data):
|
| 37 |
# print intro
|
|
@@ -108,15 +81,12 @@ iface = gr.Interface(
|
|
| 108 |
description="""
|
| 109 |
This demonstration showcases a method for analyzing sensitive data while protecting individual privacy. It uses Paillier encryption (partial homomorphic) and , a powerful technique that allows calculations on encrypted data without revealing the actual values.
|
| 110 |
|
| 111 |
-
#
|
| 112 |
-
|
| 113 |
-
Start typing below to see the output.
|
| 114 |
|
| 115 |
-
###
|
| 116 |
-
Why is this important?
|
| 117 |
|
| 118 |
- Privacy Protection: Analyzing personal data often raises privacy concerns. This method keeps individual data private even while performing calculations, like counting the number of "smokers" in a dataset.
|
| 119 |
-
- Secure Collaboration: Sensitive data can be analyzed jointly by multiple parties without anyone directly accessing the raw data. Only authorized stakeholders and data owner have access to the private key.
|
| 120 |
- Cloud Computing: This approach enables secure analysis on cloud platforms, leveraging their computing power without jeopardizing data privacy.
|
| 121 |
|
| 122 |
Watch the demo to see:
|
|
|
|
| 1 |
import gradio as gr
|
|
|
|
| 2 |
from phe import paillier
|
| 3 |
+
|
|
|
|
| 4 |
|
| 5 |
# Generate Paillier keypair
|
| 6 |
public_key, private_key = paillier.generate_paillier_keypair(n_length=1024)
|
| 7 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 8 |
|
| 9 |
def secure_encoding(input_data):
|
| 10 |
# print intro
|
|
|
|
| 81 |
description="""
|
| 82 |
This demonstration showcases a method for analyzing sensitive data while protecting individual privacy. It uses Paillier encryption (partial homomorphic) and , a powerful technique that allows calculations on encrypted data without revealing the actual values.
|
| 83 |
|
| 84 |
+
## Welcome to DNAsafe demo!
|
|
|
|
|
|
|
| 85 |
|
| 86 |
+
### Why is this important?
|
|
|
|
| 87 |
|
| 88 |
- Privacy Protection: Analyzing personal data often raises privacy concerns. This method keeps individual data private even while performing calculations, like counting the number of "smokers" in a dataset.
|
| 89 |
+
- Secure Collaboration: Sensitive data can be analyzed jointly by multiple parties without anyone directly accessing the raw data and the result. Only authorized stakeholders and data owner have access to the private key that allows them to see the raw text.
|
| 90 |
- Cloud Computing: This approach enables secure analysis on cloud platforms, leveraging their computing power without jeopardizing data privacy.
|
| 91 |
|
| 92 |
Watch the demo to see:
|