Yntec commited on
Commit
29229f4
โ€ข
1 Parent(s): 35e092d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +22 -6
app.py CHANGED
@@ -31,6 +31,21 @@ restart_thread.start()
31
  queue = Queue()
32
  queue_threshold = 100
33
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
34
  def add_random_noise(prompt, noise_level=0.00):
35
  if noise_level == 0:
36
  noise_level = 0.00
@@ -43,16 +58,17 @@ def add_random_noise(prompt, noise_level=0.00):
43
  for index in noise_indices:
44
  prompt_list[index] = random.choice(noise_chars)
45
  return "".join(prompt_list)
46
-
47
- def noadd_random_noise(prompt, noise_level=0.00):
 
48
  if noise_level == 0:
49
- noise_level = 0.00
50
  percentage_noise = noise_level * 5
51
  num_noise_chars = int(len(prompt) * (percentage_noise/100))
52
  noise_indices = random.sample(range(len(prompt)), num_noise_chars)
53
  prompt_list = list(prompt)
54
- noise_chars = list(string.ascii_letters + string.punctuation + '' + string.digits)
55
- noise_chars.extend([''])
56
  for index in noise_indices:
57
  prompt_list[index] = random.choice(noise_chars)
58
  return "".join(prompt_list)
@@ -74,7 +90,7 @@ def send_it2(inputs, noise_level, proc1=proc1):
74
  return output2
75
 
76
  def send_it3(inputs, noise_level, proc1=proc1):
77
- prompt_with_noise = add_random_noise(inputs, noise_level)
78
  while queue.qsize() >= queue_threshold:
79
  time.sleep(2)
80
  queue.put(prompt_with_noise)
 
31
  queue = Queue()
32
  queue_threshold = 100
33
 
34
+ #Don't add noise to the first picture no matter what (the point of noise is to get varied outputs, the first one doesn't need to vary about anything)
35
+ def noadd_random_noise(prompt, noise_level=0.00):
36
+ if noise_level == 0:
37
+ noise_level = 0.00
38
+ percentage_noise = noise_level * 5
39
+ num_noise_chars = int(len(prompt) * (percentage_noise/100))
40
+ noise_indices = random.sample(range(len(prompt)), num_noise_chars)
41
+ prompt_list = list(prompt)
42
+ noise_chars = list(string.ascii_letters + string.punctuation + '' + string.digits)
43
+ noise_chars.extend([''])
44
+ for index in noise_indices:
45
+ prompt_list[index] = random.choice(noise_chars)
46
+ return "".join(prompt_list)
47
+
48
+ #normal behavior
49
  def add_random_noise(prompt, noise_level=0.00):
50
  if noise_level == 0:
51
  noise_level = 0.00
 
58
  for index in noise_indices:
59
  prompt_list[index] = random.choice(noise_chars)
60
  return "".join(prompt_list)
61
+
62
+ #Give varied output even at noise level 0
63
+ def add_random_noise3(prompt, noise_level=0.00):
64
  if noise_level == 0:
65
+ noise_level = 0.00
66
  percentage_noise = noise_level * 5
67
  num_noise_chars = int(len(prompt) * (percentage_noise/100))
68
  noise_indices = random.sample(range(len(prompt)), num_noise_chars)
69
  prompt_list = list(prompt)
70
+ noise_chars = list(' ' + string.ascii_letters + string.punctuation + string.digits)
71
+ noise_chars.extend(['๐Ÿ˜', 'beautiful', '๐Ÿ˜‚', '๐Ÿค”', '๐Ÿ˜Š', '๐Ÿค—', '๐Ÿ˜ญ', '๐Ÿ™„', 'pretty', '๐Ÿคฏ', '๐Ÿคซ', '๐Ÿฅด', 'sitting', '๐Ÿคฉ', '๐Ÿฅณ', '๐Ÿ˜”', '๐Ÿ˜ฉ', '๐Ÿคช', '๐Ÿ˜‡', 'retro', '๐Ÿ˜ˆ', '๐Ÿ‘น', 'masterpiece', '๐Ÿค–', '๐Ÿ‘ฝ', 'high quality', '๐ŸŽƒ', '๐ŸŽ…', '๐ŸŽ„', '๐ŸŽ', '๐ŸŽ‚', '๐ŸŽ‰', '๐ŸŽˆ', '๐ŸŽŠ', '๐ŸŽฎ', 'โค๏ธ', '๐Ÿ’”', '๐Ÿ’•', '๐Ÿ’–', '๐Ÿ’—', '๐Ÿถ', '๐Ÿฑ', 'visible', '๐Ÿน', '๐ŸฆŠ', '๐Ÿป', '๐Ÿจ', '๐Ÿฏ', '๐Ÿฆ', '๐Ÿ˜', '๐Ÿ”ฅ', '๐ŸŒง๏ธ', '๐ŸŒž', '๐ŸŒˆ', '๐Ÿ’ฅ', '๐ŸŒด', '๐ŸŒŠ', '๐ŸŒบ', '๐ŸŒป', '๐ŸŒธ', '๐ŸŽจ', '๐ŸŒ…', '๐ŸŒŒ', 'โ˜๏ธ', 'โ›ˆ๏ธ', 'โ„๏ธ', 'โ˜€๏ธ', '๐ŸŒค๏ธ', 'โ›…๏ธ', '๐ŸŒฅ๏ธ', '๐ŸŒฆ๏ธ', '๐ŸŒง๏ธ', '๐ŸŒฉ๏ธ', '๐ŸŒจ๏ธ', '๐ŸŒซ๏ธ', 'โ˜”๏ธ', '๐ŸŒฌ๏ธ', '๐Ÿ’จ', '๐ŸŒช๏ธ', 'beautiful'])
72
  for index in noise_indices:
73
  prompt_list[index] = random.choice(noise_chars)
74
  return "".join(prompt_list)
 
90
  return output2
91
 
92
  def send_it3(inputs, noise_level, proc1=proc1):
93
+ prompt_with_noise = add_random_noise3(inputs, noise_level)
94
  while queue.qsize() >= queue_threshold:
95
  time.sleep(2)
96
  queue.put(prompt_with_noise)