Spaces:
Runtime error
Runtime error
phenomenon1981
commited on
Commit
ยท
0912eef
1
Parent(s):
1bd8763
Update app.py
Browse files
app.py
CHANGED
@@ -17,31 +17,27 @@ proc1=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0")
|
|
17 |
|
18 |
def restart_script_periodically():
|
19 |
while True:
|
20 |
-
|
21 |
-
|
22 |
-
|
23 |
-
|
24 |
-
pass
|
25 |
|
26 |
restart_thread = Thread(target=restart_script_periodically, daemon=True)
|
27 |
restart_thread.start()
|
28 |
|
|
|
29 |
queue = Queue()
|
30 |
-
queue_threshold =
|
31 |
|
32 |
-
def add_random_noise(prompt, noise_level=0.
|
33 |
if noise_level == 0:
|
34 |
-
noise_level = 0.
|
35 |
-
# Get the percentage of characters to add as noise
|
36 |
percentage_noise = noise_level * 5
|
37 |
-
# Get the number of characters to add as noise
|
38 |
num_noise_chars = int(len(prompt) * (percentage_noise/100))
|
39 |
-
# Get the indices of the characters to add noise to
|
40 |
noise_indices = random.sample(range(len(prompt)), num_noise_chars)
|
41 |
-
# Add noise to the selected characters
|
42 |
prompt_list = list(prompt)
|
43 |
-
|
44 |
-
noise_chars
|
45 |
for index in noise_indices:
|
46 |
prompt_list[index] = random.choice(noise_chars)
|
47 |
return "".join(prompt_list)
|
|
|
17 |
|
18 |
def restart_script_periodically():
|
19 |
while True:
|
20 |
+
random_time = random.randint(420, 600)
|
21 |
+
time.sleep(random_time)
|
22 |
+
os.execl(sys.executable, sys.executable, *sys.argv)
|
23 |
+
|
|
|
24 |
|
25 |
restart_thread = Thread(target=restart_script_periodically, daemon=True)
|
26 |
restart_thread.start()
|
27 |
|
28 |
+
|
29 |
queue = Queue()
|
30 |
+
queue_threshold = 100
|
31 |
|
32 |
+
def add_random_noise(prompt, noise_level=0.07):
|
33 |
if noise_level == 0:
|
34 |
+
noise_level = 0.07
|
|
|
35 |
percentage_noise = noise_level * 5
|
|
|
36 |
num_noise_chars = int(len(prompt) * (percentage_noise/100))
|
|
|
37 |
noise_indices = random.sample(range(len(prompt)), num_noise_chars)
|
|
|
38 |
prompt_list = list(prompt)
|
39 |
+
noise_chars = list(string.ascii_letters + string.punctuation + ' ' + string.digits)
|
40 |
+
noise_chars.extend(['๐', '๐ฉ', '๐', '๐ค', '๐', '๐ค', '๐ญ', '๐', '๐ท', '๐ค', '๐คฏ', '๐คซ', '๐ฅด', '๐ด', '๐คฉ', '๐ฅณ', '๐', '๐ฉ', '๐คฏ', '๐คช', '๐', '๐คข', '๐ท', '๐คฎ', '๐', '๐น', '๐ป', '๐ค', '๐ฝ', '๐', '๐', '๐
', '๐', '๐', '๐', '๐', '๐', '๐', '๐ฎ', 'โค๏ธ', '๐', '๐', '๐', '๐', '๐ถ', '๐ฑ', '๐ญ', '๐น', '๐ฆ', '๐ป', '๐จ', '๐ฏ', '๐ฆ', '๐', '๐ฅ', '๐ง๏ธ', '๐', '๐', '๐ฅ', '๐ด', '๐', '๐บ', '๐ป', '๐ธ', '๐จ', '๐
', '๐'])
|
41 |
for index in noise_indices:
|
42 |
prompt_list[index] = random.choice(noise_chars)
|
43 |
return "".join(prompt_list)
|