Spaces:
Runtime error
Runtime error
phenomenon1981
commited on
Commit
•
8f76f51
1
Parent(s):
beed0d4
Update app.py
Browse files
app.py
CHANGED
@@ -15,7 +15,7 @@ proc5=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
|
|
15 |
|
16 |
import random
|
17 |
|
18 |
-
def add_random_noise(prompt, noise_level=0.
|
19 |
# Get the percentage of characters to add as noise
|
20 |
percentage_noise = noise_level * 5
|
21 |
# Get the number of characters to add as noise
|
@@ -37,13 +37,8 @@ def send_it1(inputs, noise_level, proc1=proc1):
|
|
37 |
if not queue.empty():
|
38 |
queue.queue.clear()
|
39 |
queue_length_counter = 0
|
40 |
-
|
41 |
-
output1 = proc1(prompt_with_noise, timeout=60) #set a timeout of 60 seconds
|
42 |
-
except gr.TimeoutError:
|
43 |
-
print("The model took too long to generate a response. Exiting.")
|
44 |
-
sys.exit()
|
45 |
queue_length_counter += 1
|
46 |
-
time.sleep(3)
|
47 |
return output1
|
48 |
time.sleep(1)
|
49 |
|
@@ -56,7 +51,6 @@ def send_it2(inputs, noise_level, proc1=proc1):
|
|
56 |
queue_length_counter = 0
|
57 |
output2 = proc1(prompt_with_noise)
|
58 |
queue_length_counter += 1
|
59 |
-
time.sleep(3)
|
60 |
return output2
|
61 |
time.sleep(1)
|
62 |
|
@@ -69,7 +63,6 @@ def send_it3(inputs, noise_level, proc1=proc1):
|
|
69 |
queue_length_counter = 0
|
70 |
output3 = proc1(prompt_with_noise)
|
71 |
queue_length_counter += 1
|
72 |
-
time.sleep(3)
|
73 |
return output3
|
74 |
time.sleep(1)
|
75 |
|
@@ -82,7 +75,6 @@ def send_it4(inputs, noise_level, proc1=proc1):
|
|
82 |
queue_length_counter = 0
|
83 |
output4 = proc1(prompt_with_noise)
|
84 |
queue_length_counter += 1
|
85 |
-
time.sleep(3)
|
86 |
return output4
|
87 |
time.sleep(1)
|
88 |
|
@@ -95,7 +87,6 @@ def send_it5(inputs, noise_level, proc5=proc5):
|
|
95 |
queue_length_counter = 0
|
96 |
output5 = proc5(prompt_with_noise)
|
97 |
queue_length_counter += 1
|
98 |
-
time.sleep(3)
|
99 |
return output5
|
100 |
time.sleep(1)
|
101 |
|
@@ -108,7 +99,6 @@ def send_it6(inputs, noise_level, proc5=proc5):
|
|
108 |
queue_length_counter = 0
|
109 |
output6 = proc5(prompt_with_noise)
|
110 |
queue_length_counter += 1
|
111 |
-
time.sleep(3)
|
112 |
return output6
|
113 |
time.sleep(1)
|
114 |
|
@@ -121,7 +111,6 @@ def send_it7(inputs, noise_level, proc5=proc5):
|
|
121 |
queue_length_counter = 0
|
122 |
output7 = proc5(prompt_with_noise)
|
123 |
queue_length_counter += 1
|
124 |
-
time.sleep(3)
|
125 |
return output7
|
126 |
time.sleep(1)
|
127 |
|
@@ -134,7 +123,6 @@ def send_it8(inputs, noise_level, proc5=proc5):
|
|
134 |
queue_length_counter = 0
|
135 |
output8 = proc5(prompt_with_noise)
|
136 |
queue_length_counter += 1
|
137 |
-
time.sleep(3)
|
138 |
return output8
|
139 |
time.sleep(1)
|
140 |
|
@@ -148,7 +136,6 @@ def get_prompts(prompt_text):
|
|
148 |
queue_length_counter = 0
|
149 |
output = text_gen(prompt_text)
|
150 |
queue_length_counter += 1
|
151 |
-
time.sleep(3)
|
152 |
return output
|
153 |
time.sleep(1)
|
154 |
|
|
|
15 |
|
16 |
import random
|
17 |
|
18 |
+
def add_random_noise(prompt, noise_level=0.07):
|
19 |
# Get the percentage of characters to add as noise
|
20 |
percentage_noise = noise_level * 5
|
21 |
# Get the number of characters to add as noise
|
|
|
37 |
if not queue.empty():
|
38 |
queue.queue.clear()
|
39 |
queue_length_counter = 0
|
40 |
+
output1 = proc1(prompt_with_noise)
|
|
|
|
|
|
|
|
|
41 |
queue_length_counter += 1
|
|
|
42 |
return output1
|
43 |
time.sleep(1)
|
44 |
|
|
|
51 |
queue_length_counter = 0
|
52 |
output2 = proc1(prompt_with_noise)
|
53 |
queue_length_counter += 1
|
|
|
54 |
return output2
|
55 |
time.sleep(1)
|
56 |
|
|
|
63 |
queue_length_counter = 0
|
64 |
output3 = proc1(prompt_with_noise)
|
65 |
queue_length_counter += 1
|
|
|
66 |
return output3
|
67 |
time.sleep(1)
|
68 |
|
|
|
75 |
queue_length_counter = 0
|
76 |
output4 = proc1(prompt_with_noise)
|
77 |
queue_length_counter += 1
|
|
|
78 |
return output4
|
79 |
time.sleep(1)
|
80 |
|
|
|
87 |
queue_length_counter = 0
|
88 |
output5 = proc5(prompt_with_noise)
|
89 |
queue_length_counter += 1
|
|
|
90 |
return output5
|
91 |
time.sleep(1)
|
92 |
|
|
|
99 |
queue_length_counter = 0
|
100 |
output6 = proc5(prompt_with_noise)
|
101 |
queue_length_counter += 1
|
|
|
102 |
return output6
|
103 |
time.sleep(1)
|
104 |
|
|
|
111 |
queue_length_counter = 0
|
112 |
output7 = proc5(prompt_with_noise)
|
113 |
queue_length_counter += 1
|
|
|
114 |
return output7
|
115 |
time.sleep(1)
|
116 |
|
|
|
123 |
queue_length_counter = 0
|
124 |
output8 = proc5(prompt_with_noise)
|
125 |
queue_length_counter += 1
|
|
|
126 |
return output8
|
127 |
time.sleep(1)
|
128 |
|
|
|
136 |
queue_length_counter = 0
|
137 |
output = text_gen(prompt_text)
|
138 |
queue_length_counter += 1
|
|
|
139 |
return output
|
140 |
time.sleep(1)
|
141 |
|