Spaces:
Runtime error
Runtime error
phenomenon1981
commited on
Commit
•
6f9c52b
1
Parent(s):
46977ce
Update app.py
Browse files
app.py
CHANGED
@@ -5,11 +5,12 @@ from pathlib import Path
|
|
5 |
import random
|
6 |
import string
|
7 |
import time
|
8 |
-
import threading
|
9 |
-
from threading import Thread
|
10 |
from queue import Queue
|
|
|
11 |
|
12 |
text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
|
|
|
|
|
13 |
proc1=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0")
|
14 |
|
15 |
def restart_script_periodically():
|
@@ -40,49 +41,69 @@ def add_random_noise(prompt, noise_level=0.07):
|
|
40 |
|
41 |
def send_it1(inputs, noise_level, proc1=proc1):
|
42 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
|
|
|
|
|
|
43 |
output1 = proc1(prompt_with_noise)
|
44 |
return output1
|
45 |
|
46 |
def send_it2(inputs, noise_level, proc1=proc1):
|
47 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
|
|
|
|
|
|
48 |
output2 = proc1(prompt_with_noise)
|
49 |
return output2
|
50 |
|
51 |
def send_it3(inputs, noise_level, proc1=proc1):
|
52 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
|
|
|
|
|
|
53 |
output3 = proc1(prompt_with_noise)
|
54 |
return output3
|
55 |
|
56 |
def send_it4(inputs, noise_level, proc1=proc1):
|
57 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
|
|
|
|
|
|
58 |
output4 = proc1(prompt_with_noise)
|
59 |
return output4
|
60 |
|
61 |
def send_it5(inputs, noise_level, proc1=proc1):
|
62 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
|
|
|
|
|
|
63 |
output5 = proc1(prompt_with_noise)
|
64 |
return output5
|
65 |
|
66 |
def send_it6(inputs, noise_level, proc1=proc1):
|
67 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
|
|
|
|
|
|
68 |
output6 = proc1(prompt_with_noise)
|
69 |
return output6
|
70 |
|
71 |
def send_it7(inputs, noise_level, proc1=proc1):
|
72 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
|
|
|
|
|
|
73 |
output7 = proc1(prompt_with_noise)
|
74 |
return output7
|
75 |
|
76 |
def send_it8(inputs, noise_level, proc1=proc1):
|
77 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
|
|
|
|
|
|
78 |
output8 = proc1(prompt_with_noise)
|
79 |
return output8
|
80 |
|
81 |
|
82 |
-
def get_prompts(prompt_text):
|
83 |
-
return text_gen(prompt_text)
|
84 |
-
|
85 |
-
|
86 |
with gr.Blocks() as myface:
|
87 |
with gr.Row():
|
88 |
|
|
|
5 |
import random
|
6 |
import string
|
7 |
import time
|
|
|
|
|
8 |
from queue import Queue
|
9 |
+
from threading import Thread
|
10 |
|
11 |
text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
|
12 |
+
def get_prompts(prompt_text):
|
13 |
+
return text_gen(prompt_text)
|
14 |
proc1=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0")
|
15 |
|
16 |
def restart_script_periodically():
|
|
|
41 |
|
42 |
def send_it1(inputs, noise_level, proc1=proc1):
|
43 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
44 |
+
while queue.qsize() >= queue_threshold:
|
45 |
+
time.sleep(2)
|
46 |
+
queue.put(prompt_with_noise)
|
47 |
output1 = proc1(prompt_with_noise)
|
48 |
return output1
|
49 |
|
50 |
def send_it2(inputs, noise_level, proc1=proc1):
|
51 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
52 |
+
while queue.qsize() >= queue_threshold:
|
53 |
+
time.sleep(2)
|
54 |
+
queue.put(prompt_with_noise)
|
55 |
output2 = proc1(prompt_with_noise)
|
56 |
return output2
|
57 |
|
58 |
def send_it3(inputs, noise_level, proc1=proc1):
|
59 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
60 |
+
while queue.qsize() >= queue_threshold:
|
61 |
+
time.sleep(2)
|
62 |
+
queue.put(prompt_with_noise)
|
63 |
output3 = proc1(prompt_with_noise)
|
64 |
return output3
|
65 |
|
66 |
def send_it4(inputs, noise_level, proc1=proc1):
|
67 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
68 |
+
while queue.qsize() >= queue_threshold:
|
69 |
+
time.sleep(2)
|
70 |
+
queue.put(prompt_with_noise)
|
71 |
output4 = proc1(prompt_with_noise)
|
72 |
return output4
|
73 |
|
74 |
def send_it5(inputs, noise_level, proc1=proc1):
|
75 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
76 |
+
while queue.qsize() >= queue_threshold:
|
77 |
+
time.sleep(2)
|
78 |
+
queue.put(prompt_with_noise)
|
79 |
output5 = proc1(prompt_with_noise)
|
80 |
return output5
|
81 |
|
82 |
def send_it6(inputs, noise_level, proc1=proc1):
|
83 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
84 |
+
while queue.qsize() >= queue_threshold:
|
85 |
+
time.sleep(2)
|
86 |
+
queue.put(prompt_with_noise)
|
87 |
output6 = proc1(prompt_with_noise)
|
88 |
return output6
|
89 |
|
90 |
def send_it7(inputs, noise_level, proc1=proc1):
|
91 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
92 |
+
while queue.qsize() >= queue_threshold:
|
93 |
+
time.sleep(2)
|
94 |
+
queue.put(prompt_with_noise)
|
95 |
output7 = proc1(prompt_with_noise)
|
96 |
return output7
|
97 |
|
98 |
def send_it8(inputs, noise_level, proc1=proc1):
|
99 |
prompt_with_noise = add_random_noise(inputs, noise_level)
|
100 |
+
while queue.qsize() >= queue_threshold:
|
101 |
+
time.sleep(2)
|
102 |
+
queue.put(prompt_with_noise)
|
103 |
output8 = proc1(prompt_with_noise)
|
104 |
return output8
|
105 |
|
106 |
|
|
|
|
|
|
|
|
|
107 |
with gr.Blocks() as myface:
|
108 |
with gr.Row():
|
109 |
|