phenomenon1981 commited on
Commit
d6f8b87
1 Parent(s): ae5b9e6

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -1
app.py CHANGED
@@ -7,6 +7,7 @@ import string
7
  import time
8
  from queue import Queue
9
  from threading import Thread
 
10
 
11
  text_gen=gr.Interface.load("spaces/Gustavosta/MagicPrompt-Stable-Diffusion")
12
  def get_prompts(prompt_text):
@@ -36,12 +37,14 @@ def add_random_noise(prompt, noise_level=0.07):
36
  noise_indices = random.sample(range(len(prompt)), num_noise_chars)
37
  # Add noise to the selected characters
38
  prompt_list = list(prompt)
39
- noise_chars = string.ascii_letters + string.punctuation + ' '
 
40
  for index in noise_indices:
41
  prompt_list[index] = random.choice(noise_chars)
42
  return "".join(prompt_list)
43
 
44
 
 
45
  def send_it1(inputs, noise_level, proc1=proc1):
46
  prompt_with_noise = add_random_noise(inputs, noise_level)
47
  while queue.qsize() >= queue_threshold:
 
7
  import time
8
  from queue import Queue
9
  from threading import Thread
10
+ import emoji
11
 
12
  text_gen=gr.Interface.load("spaces/Gustavosta/MagicPrompt-Stable-Diffusion")
13
  def get_prompts(prompt_text):
 
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 all emojis to the list of characters used to add noise
41
+ noise_chars = string.ascii_letters + string.punctuation + ' ' + string.digits + emoji.emojize(":all:")
42
  for index in noise_indices:
43
  prompt_list[index] = random.choice(noise_chars)
44
  return "".join(prompt_list)
45
 
46
 
47
+
48
  def send_it1(inputs, noise_level, proc1=proc1):
49
  prompt_with_noise = add_random_noise(inputs, noise_level)
50
  while queue.qsize() >= queue_threshold: