phenomenon1981 commited on
Commit
1450cbb
ยท
1 Parent(s): 6f0b6f4

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +1 -6
app.py CHANGED
@@ -29,17 +29,12 @@ queue_threshold = 100
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
35
  num_noise_chars = int(len(prompt) * (percentage_noise/100))
36
- # Get the indices of the characters to add noise to
37
  noise_indices = random.sample(range(len(prompt)), num_noise_chars)
38
- # Add noise to the selected characters
39
  prompt_list = list(prompt)
40
- # Add numbers, special characters, and a selection of 100 popular 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(['๐Ÿ˜', '๐Ÿ’ฉ', '๐Ÿ˜‚', '๐Ÿค”', '๐Ÿ˜Š', '๐Ÿค—', '๐Ÿ˜ญ', '๐Ÿ™„', '๐Ÿ˜ท', '๐Ÿค”', '๐Ÿคฏ', '๐Ÿคซ', '๐Ÿฅด', '๐Ÿ˜ด', '๐Ÿคฉ', '๐Ÿฅณ', '๐Ÿ˜”', '๐Ÿ˜ฉ', '๐Ÿคฏ', '๐Ÿคช', '๐Ÿ˜‡', '๐Ÿคข', '๐Ÿ˜ท', '๐Ÿคฎ', '๐Ÿ˜ˆ', '๐Ÿ‘น', '๐Ÿ‘ป', '๐Ÿค–', '๐Ÿ‘ฝ', '๐Ÿ’€', '๐ŸŽƒ', '๐ŸŽ…', '๐ŸŽ„', '๐ŸŽ', '๐ŸŽ‚', '๐ŸŽ‰', '๐ŸŽˆ', '๐ŸŽŠ', '๐ŸŽŒ', '๐ŸŽ', '๐ŸŽ‘', '๐ŸŽ“', '๐ŸŽ’', '๐ŸŽฒ', '๐ŸŽฏ', '๐ŸŽฐ', '๐ŸŽฑ', '๐ŸŽฎ', '๐Ÿฅฐ', '๐Ÿฅณ', '๐Ÿฅด', '๐Ÿฅบ', '๐Ÿฅธ', '๐Ÿฅน', '๐Ÿค', '๐Ÿคž', '๐ŸคŸ', '๐Ÿค˜', '๐Ÿค™', '๐Ÿคš', '๐Ÿค›', '๐Ÿคœ', '๐Ÿค', '๐Ÿคž', '๐ŸคŸ'])
43
  for index in noise_indices:
44
  prompt_list[index] = random.choice(noise_chars)
45
  return "".join(prompt_list)
 
29
  def add_random_noise(prompt, noise_level=0.07):
30
  if noise_level == 0:
31
  noise_level = 0.07
 
32
  percentage_noise = noise_level * 5
 
33
  num_noise_chars = int(len(prompt) * (percentage_noise/100))
 
34
  noise_indices = random.sample(range(len(prompt)), num_noise_chars)
 
35
  prompt_list = list(prompt)
 
36
  noise_chars = list(string.ascii_letters + string.punctuation + ' ' + string.digits)
37
+ noise_chars.extend(['๐Ÿ˜', '๐Ÿ’ฉ', '๐Ÿ˜‚', '๐Ÿค”', '๐Ÿ˜Š', '๐Ÿค—', '๐Ÿ˜ญ', '๐Ÿ™„', '๐Ÿ˜ท', '๐Ÿค”', '๐Ÿคฏ', '๐Ÿคซ', '๐Ÿฅด', '๐Ÿ˜ด', '๐Ÿคฉ', '๐Ÿฅณ', '๐Ÿ˜”', '๐Ÿ˜ฉ', '๐Ÿคฏ', '๐Ÿคช', '๐Ÿ˜‡', '๐Ÿคข', '๐Ÿ˜ท', '๐Ÿคฎ', '๐Ÿ˜ˆ', '๐Ÿ‘น', '๐Ÿ‘ป', '๐Ÿค–', '๐Ÿ‘ฝ', '๐Ÿ’€', '๐ŸŽƒ', '๐ŸŽ…', '๐ŸŽ„', '๐ŸŽ', '๐ŸŽ‚', '๐ŸŽ‰', '๐ŸŽˆ', '๐ŸŽŠ', '๐ŸŽฎ', 'โค๏ธ', '๐Ÿ’”', '๐Ÿ’•', '๐Ÿ’–', '๐Ÿ’—', '๐Ÿถ', '๐Ÿฑ', '๐Ÿญ', '๐Ÿน', '๐ŸฆŠ', '๐Ÿป', '๐Ÿจ', '๐Ÿฏ', '๐Ÿฆ', '๐Ÿ˜', '๐Ÿ”ฅ', '๐ŸŒง๏ธ', '๐ŸŒž', '๐ŸŒˆ', '๐Ÿ’ฅ', '๐ŸŒด', '๐ŸŒŠ', '๐ŸŒบ', '๐ŸŒป', '๐ŸŒธ', '๐ŸŽจ', '๐ŸŒ…', '๐ŸŒŒ'])
38
  for index in noise_indices:
39
  prompt_list[index] = random.choice(noise_chars)
40
  return "".join(prompt_list)