Spaces:
Runtime error
Runtime error
Update app.py
Browse files
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 =
|
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)
|