Spaces:
Runtime error
Runtime error
phenomenon1981
commited on
Commit
•
923f238
1
Parent(s):
5955a62
Update app.py
Browse files
app.py
CHANGED
@@ -26,9 +26,9 @@ restart_thread.start()
|
|
26 |
queue = Queue()
|
27 |
queue_threshold = 100
|
28 |
|
29 |
-
def add_random_noise(prompt, noise_level=0.
|
30 |
if noise_level == 0:
|
31 |
-
noise_level = 0.
|
32 |
# Get the percentage of characters to add as noise
|
33 |
percentage_noise = noise_level * 5
|
34 |
# Get the number of characters to add as noise
|
@@ -38,7 +38,8 @@ def add_random_noise(prompt, noise_level=0.00):
|
|
38 |
# Add noise to the selected characters
|
39 |
prompt_list = list(prompt)
|
40 |
# Add numbers, special characters, and all emojis to the list of characters used to add noise
|
41 |
-
noise_chars = string.ascii_letters + string.punctuation + ' ' + string.digits
|
|
|
42 |
for index in noise_indices:
|
43 |
prompt_list[index] = random.choice(noise_chars)
|
44 |
return "".join(prompt_list)
|
|
|
26 |
queue = Queue()
|
27 |
queue_threshold = 100
|
28 |
|
29 |
+
def add_random_noise(prompt, noise_level=0.07):
|
30 |
if noise_level == 0:
|
31 |
+
noise_level = 0.07
|
32 |
# Get the percentage of characters to add as noise
|
33 |
percentage_noise = noise_level * 5
|
34 |
# Get the number of characters to add as noise
|
|
|
38 |
# Add noise to the selected characters
|
39 |
prompt_list = list(prompt)
|
40 |
# Add numbers, special characters, and all emojis to the list of characters used to add noise
|
41 |
+
noise_chars = list(string.ascii_letters + string.punctuation + ' ' + string.digits)
|
42 |
+
noise_chars.extend(emoji.emojize(":all:").split())
|
43 |
for index in noise_indices:
|
44 |
prompt_list[index] = random.choice(noise_chars)
|
45 |
return "".join(prompt_list)
|