Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -192,22 +192,9 @@ with demo:
|
|
| 192 |
|
| 193 |
gr.Markdown(
|
| 194 |
"""
|
| 195 |
-
|
| 196 |
-
|
| 197 |
-
|
| 198 |
-
<h2 align="center">Sentiment Analysis On Encrypted Data Using Homomorphic Encryption</h2>
|
| 199 |
-
<p align="center">
|
| 200 |
-
<a href="https://github.com/zama-ai/concrete-ml"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="https://user-images.githubusercontent.com/5758427/197972109-faaaff3e-10e2-4ab6-80f5-7531f7cfb08f.png">Concrete-ML</a>
|
| 201 |
-
—
|
| 202 |
-
<a href="https://docs.zama.ai/concrete-ml"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="https://user-images.githubusercontent.com/5758427/197976802-fddd34c5-f59a-48d0-9bff-7ad1b00cb1fb.png">Documentation</a>
|
| 203 |
-
—
|
| 204 |
-
<a href="https://zama.ai/community"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="https://user-images.githubusercontent.com/5758427/197977153-8c9c01a7-451a-4993-8e10-5a6ed5343d02.png">Community</a>
|
| 205 |
-
—
|
| 206 |
-
<a href="https://twitter.com/zama_fhe"> <img style="vertical-align: middle; display:inline-block; margin-right: 3px;" width=15 src="https://user-images.githubusercontent.com/5758427/197975044-bab9d199-e120-433b-b3be-abd73b211a54.png">@zama_fhe</a>
|
| 207 |
-
</p>
|
| 208 |
-
<p align="center">
|
| 209 |
-
<img src="https://user-images.githubusercontent.com/56846628/219329304-6868be9e-5ce8-4279-9123-4cb1bc0c2fb5.png" width="60%" height="60%">
|
| 210 |
-
</p>
|
| 211 |
"""
|
| 212 |
)
|
| 213 |
|
|
@@ -251,29 +238,29 @@ with demo:
|
|
| 251 |
visible=False
|
| 252 |
)
|
| 253 |
|
| 254 |
-
gr.Markdown("# Step 2: Provide a
|
| 255 |
gr.Markdown("## Client side")
|
| 256 |
gr.Markdown(
|
| 257 |
-
"Enter a
|
| 258 |
)
|
| 259 |
-
text = gr.Textbox(label="Enter
|
| 260 |
|
| 261 |
gr.Markdown("# Step 3: Encode the message with the private key")
|
| 262 |
b_encode_quantize_text = gr.Button(
|
| 263 |
-
"Encode, quantize and encrypt the text with
|
| 264 |
)
|
| 265 |
|
| 266 |
with gr.Row():
|
| 267 |
encoding = gr.Textbox(
|
| 268 |
-
label="
|
| 269 |
max_lines=4,
|
| 270 |
interactive=False,
|
| 271 |
)
|
| 272 |
quantized_encoding = gr.Textbox(
|
| 273 |
-
label="Quantized
|
| 274 |
)
|
| 275 |
encrypted_quantized_encoding = gr.Textbox(
|
| 276 |
-
label="Encrypted quantized
|
| 277 |
max_lines=4,
|
| 278 |
interactive=False,
|
| 279 |
)
|
|
@@ -291,14 +278,14 @@ with demo:
|
|
| 291 |
interactive=False,
|
| 292 |
)
|
| 293 |
|
| 294 |
-
gr.Markdown("# Step 5: Decrypt the
|
| 295 |
gr.Markdown("## Client side")
|
| 296 |
gr.Markdown(
|
| 297 |
"The encrypted sentiment is sent back to client, who can finally decrypt it with its private key. Only the client is aware of the original tweet and the prediction."
|
| 298 |
)
|
| 299 |
b_decrypt_prediction = gr.Button("Decrypt prediction")
|
| 300 |
|
| 301 |
-
labels_sentiment = gr.Label(label="
|
| 302 |
|
| 303 |
# Button for key generation
|
| 304 |
b_gen_key_and_install.click(keygen, inputs=[task_checkbox], outputs=[evaluation_key, user_id])
|
|
|
|
| 192 |
|
| 193 |
gr.Markdown(
|
| 194 |
"""
|
| 195 |
+
|
| 196 |
+
<h2 align="center">Contract Analysis</h2>
|
| 197 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 198 |
"""
|
| 199 |
)
|
| 200 |
|
|
|
|
| 238 |
visible=False
|
| 239 |
)
|
| 240 |
|
| 241 |
+
gr.Markdown("# Step 2: Provide a contract or clause")
|
| 242 |
gr.Markdown("## Client side")
|
| 243 |
gr.Markdown(
|
| 244 |
+
"Enter a contract or clause you want to analysis)."
|
| 245 |
)
|
| 246 |
+
text = gr.Textbox(label="Enter some words:", value="The Employee is entitled to two weeks of paid vacation annually, to be scheduled at the mutual convenience of the Employee and Employer.")
|
| 247 |
|
| 248 |
gr.Markdown("# Step 3: Encode the message with the private key")
|
| 249 |
b_encode_quantize_text = gr.Button(
|
| 250 |
+
"Encode, quantize and encrypt the text with vectorizer, and send to server"
|
| 251 |
)
|
| 252 |
|
| 253 |
with gr.Row():
|
| 254 |
encoding = gr.Textbox(
|
| 255 |
+
label="Representation:",
|
| 256 |
max_lines=4,
|
| 257 |
interactive=False,
|
| 258 |
)
|
| 259 |
quantized_encoding = gr.Textbox(
|
| 260 |
+
label="Quantized representation:", max_lines=4, interactive=False
|
| 261 |
)
|
| 262 |
encrypted_quantized_encoding = gr.Textbox(
|
| 263 |
+
label="Encrypted quantized representation (truncated):",
|
| 264 |
max_lines=4,
|
| 265 |
interactive=False,
|
| 266 |
)
|
|
|
|
| 278 |
interactive=False,
|
| 279 |
)
|
| 280 |
|
| 281 |
+
gr.Markdown("# Step 5: Decrypt the class")
|
| 282 |
gr.Markdown("## Client side")
|
| 283 |
gr.Markdown(
|
| 284 |
"The encrypted sentiment is sent back to client, who can finally decrypt it with its private key. Only the client is aware of the original tweet and the prediction."
|
| 285 |
)
|
| 286 |
b_decrypt_prediction = gr.Button("Decrypt prediction")
|
| 287 |
|
| 288 |
+
labels_sentiment = gr.Label(label="level:")
|
| 289 |
|
| 290 |
# Button for key generation
|
| 291 |
b_gen_key_and_install.click(keygen, inputs=[task_checkbox], outputs=[evaluation_key, user_id])
|