Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -9,6 +9,7 @@ import random
|
|
| 9 |
from silverspeak import (
|
| 10 |
random_attack as random_homoglyphs_attack,
|
| 11 |
)
|
|
|
|
| 12 |
|
| 13 |
|
| 14 |
def random_deletion_attack(original_text, percentage=0.1, random_seed=42):
|
|
@@ -44,17 +45,18 @@ inputs = [
|
|
| 44 |
value=0.05,
|
| 45 |
label="Percentage of characters to replace",
|
| 46 |
),
|
| 47 |
-
gr.
|
|
|
|
| 48 |
]
|
| 49 |
outputs = gr.Textbox(label="Output text", show_copy_button=True)
|
| 50 |
title = "Silverspeak"
|
| 51 |
-
description = """Here, we utilize homoglyph
|
| 52 |
|
| 53 |
For more information, please refer to the research paper: [Creo, Aldan and Shushanta Pudasaini. “Evading AI-Generated Content Detectors using Homoglyphs.” (2024)](https://arxiv.org/abs/2109.06255)."""
|
| 54 |
|
| 55 |
-
def attack_fn(text, replace_chars, percentage, replace_spaces):
|
| 56 |
if replace_chars:
|
| 57 |
-
text = random_homoglyphs_attack(text=text, percentage=percentage, types_of_homoglyphs_to_use=
|
| 58 |
if replace_spaces:
|
| 59 |
text = random_deletion_attack(original_text=text, percentage=percentage)
|
| 60 |
return text
|
|
|
|
| 9 |
from silverspeak import (
|
| 10 |
random_attack as random_homoglyphs_attack,
|
| 11 |
)
|
| 12 |
+
from silverspeak.homoglyphs.utils import TypesOfHomoglyphs
|
| 13 |
|
| 14 |
|
| 15 |
def random_deletion_attack(original_text, percentage=0.1, random_seed=42):
|
|
|
|
| 45 |
value=0.05,
|
| 46 |
label="Percentage of characters to replace",
|
| 47 |
),
|
| 48 |
+
gr.Dropdown(value=['identical'], multiselect=True, choices=[x.value for x in TypesOfHomoglyphs])
|
| 49 |
+
gr.Checkbox(label="Zero-Width", value=False, show=False),
|
| 50 |
]
|
| 51 |
outputs = gr.Textbox(label="Output text", show_copy_button=True)
|
| 52 |
title = "Silverspeak"
|
| 53 |
+
description = """Here, we utilize homoglyph attacks to evade AI-generated content detection systems.
|
| 54 |
|
| 55 |
For more information, please refer to the research paper: [Creo, Aldan and Shushanta Pudasaini. “Evading AI-Generated Content Detectors using Homoglyphs.” (2024)](https://arxiv.org/abs/2109.06255)."""
|
| 56 |
|
| 57 |
+
def attack_fn(text, replace_chars, percentage, types_of_homoglyphs, replace_spaces):
|
| 58 |
if replace_chars:
|
| 59 |
+
text = random_homoglyphs_attack(text=text, percentage=percentage, types_of_homoglyphs_to_use=types_of_homoglyphs)
|
| 60 |
if replace_spaces:
|
| 61 |
text = random_deletion_attack(original_text=text, percentage=percentage)
|
| 62 |
return text
|