Yntec commited on
Commit
9d2d89f
ยท
1 Parent(s): 6531a99

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -16
app.py CHANGED
@@ -59,20 +59,6 @@ def add_random_noise(prompt, noise_level=0.00):
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)
75
-
76
  def send_it1(inputs, noise_level, proc1=proc1):
77
  prompt_with_noise = noadd_random_noise(inputs, noise_level)
78
  while queue.qsize() >= queue_threshold:
@@ -90,7 +76,7 @@ def send_it2(inputs, noise_level, proc1=proc1):
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)
@@ -152,7 +138,7 @@ with gr.Blocks(css='style.css') as demo:
152
  with gr.Row():
153
  with gr.Row():
154
  #Now that the first box generates a picture with noise=0 having the default at 0 makes no sense as it'd generate the same image 6 times.
155
- noise_level = gr.Slider(minimum=0.1, maximum=3, step=0.1, label="Noise Level")
156
  with gr.Row():
157
  with gr.Row():
158
  output1=gr.Image(label="Dreamlike Anime 1.0",show_label=False)
 
59
  prompt_list[index] = random.choice(noise_chars)
60
  return "".join(prompt_list)
61
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
62
  def send_it1(inputs, noise_level, proc1=proc1):
63
  prompt_with_noise = noadd_random_noise(inputs, noise_level)
64
  while queue.qsize() >= queue_threshold:
 
76
  return output2
77
 
78
  def send_it3(inputs, noise_level, proc1=proc1):
79
+ prompt_with_noise = add_random_noise(inputs, noise_level)
80
  while queue.qsize() >= queue_threshold:
81
  time.sleep(2)
82
  queue.put(prompt_with_noise)
 
138
  with gr.Row():
139
  with gr.Row():
140
  #Now that the first box generates a picture with noise=0 having the default at 0 makes no sense as it'd generate the same image 6 times.
141
+ noise_level = gr.Slider(minimum=0.1, maximum=3, step=0.1, label="Noise Level (0 was generating the same pic 6 times! ๐Ÿคฃ)")
142
  with gr.Row():
143
  with gr.Row():
144
  output1=gr.Image(label="Dreamlike Anime 1.0",show_label=False)