phenomenon1981 commited on
Commit
cf37cf4
1 Parent(s): de57a21

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +14 -15
app.py CHANGED
@@ -9,8 +9,7 @@ from queue import Queue
9
  queue = Queue()
10
 
11
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
12
- proc1=gr.Interface.load("models/dreamlike-art/dreamlike-photoreal-2.0")
13
- proc5=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
14
 
15
  def reset_queue_periodically():
16
  start_time = time.time()
@@ -83,50 +82,50 @@ def send_it4(inputs, noise_level, proc1=proc1):
83
  return output4
84
  time.sleep(1)
85
 
86
- def send_it5(inputs, noise_level, proc5=proc5):
87
  global queue_length_counter
88
  prompt_with_noise = add_random_noise(inputs, noise_level)
89
  if queue_length_counter >= 15:
90
  if not queue.empty():
91
  queue.queue.clear()
92
  queue_length_counter = 0
93
- output5 = proc5(prompt_with_noise)
94
  queue_length_counter += 1
95
  return output5
96
  time.sleep(1)
97
 
98
- def send_it6(inputs, noise_level, proc5=proc5):
99
  global queue_length_counter
100
  prompt_with_noise = add_random_noise(inputs, noise_level)
101
  if queue_length_counter >= 15:
102
  if not queue.empty():
103
  queue.queue.clear()
104
  queue_length_counter = 0
105
- output6 = proc5(prompt_with_noise)
106
  queue_length_counter += 1
107
  return output6
108
  time.sleep(1)
109
 
110
- def send_it7(inputs, noise_level, proc5=proc5):
111
  global queue_length_counter
112
  prompt_with_noise = add_random_noise(inputs, noise_level)
113
  if queue_length_counter >= 15:
114
  if not queue.empty():
115
  queue.queue.clear()
116
  queue_length_counter = 0
117
- output7 = proc5(prompt_with_noise)
118
  queue_length_counter += 1
119
  return output7
120
  time.sleep(1)
121
 
122
- def send_it8(inputs, noise_level, proc5=proc5):
123
  global queue_length_counter
124
  prompt_with_noise = add_random_noise(inputs, noise_level)
125
  if queue_length_counter >= 15:
126
  if not queue.empty():
127
  queue.queue.clear()
128
  queue_length_counter = 0
129
- output8 = proc5(prompt_with_noise)
130
  queue_length_counter += 1
131
  return output8
132
  time.sleep(1)
@@ -159,11 +158,11 @@ with gr.Blocks() as myface:
159
  with gr.Row():
160
  like_message = gr.Button("❤️ Press the Like Button if you enjoy my space! ❤️")
161
  with gr.Row():
162
- output1=gr.Image(label="Dreamlike Photoreal 2.0")
163
- output2=gr.Image(label="Dreamlike Photoreal 2.0")
164
  with gr.Row():
165
- output3=gr.Image(label="Dreamlike Photoreal 2.0")
166
- output4=gr.Image(label="Dreamlike Photoreal 2.0")
167
  with gr.Row():
168
  output5=gr.Image(label="Dreamlike Diffusion 1.0")
169
  output6=gr.Image(label="Dreamlike Diffusion 1.0")
@@ -187,6 +186,6 @@ with gr.Blocks() as myface:
187
  myface.queue(concurrency_count=8)
188
  myface.launch(enable_queue=True, inline=True)
189
  while True:
190
- if queue.qsize() >= 20:
191
  queue.queue.clear()
192
  time.sleep(30)
 
9
  queue = Queue()
10
 
11
  text_gen=gr.Interface.load("spaces/Omnibus/MagicPrompt-Stable-Diffusion")
12
+ proc1=gr.Interface.load("models/dreamlike-art/dreamlike-diffusion-1.0")
 
13
 
14
  def reset_queue_periodically():
15
  start_time = time.time()
 
82
  return output4
83
  time.sleep(1)
84
 
85
+ def send_it5(inputs, noise_level, proc1=proc1):
86
  global queue_length_counter
87
  prompt_with_noise = add_random_noise(inputs, noise_level)
88
  if queue_length_counter >= 15:
89
  if not queue.empty():
90
  queue.queue.clear()
91
  queue_length_counter = 0
92
+ output5 = proc1(prompt_with_noise)
93
  queue_length_counter += 1
94
  return output5
95
  time.sleep(1)
96
 
97
+ def send_it6(inputs, noise_level, proc1=proc1):
98
  global queue_length_counter
99
  prompt_with_noise = add_random_noise(inputs, noise_level)
100
  if queue_length_counter >= 15:
101
  if not queue.empty():
102
  queue.queue.clear()
103
  queue_length_counter = 0
104
+ output6 = proc1(prompt_with_noise)
105
  queue_length_counter += 1
106
  return output6
107
  time.sleep(1)
108
 
109
+ def send_it7(inputs, noise_level, proc1=proc1):
110
  global queue_length_counter
111
  prompt_with_noise = add_random_noise(inputs, noise_level)
112
  if queue_length_counter >= 15:
113
  if not queue.empty():
114
  queue.queue.clear()
115
  queue_length_counter = 0
116
+ output7 = proc1(prompt_with_noise)
117
  queue_length_counter += 1
118
  return output7
119
  time.sleep(1)
120
 
121
+ def send_it8(inputs, noise_level, proc1=proc1):
122
  global queue_length_counter
123
  prompt_with_noise = add_random_noise(inputs, noise_level)
124
  if queue_length_counter >= 15:
125
  if not queue.empty():
126
  queue.queue.clear()
127
  queue_length_counter = 0
128
+ output8 = proc1(prompt_with_noise)
129
  queue_length_counter += 1
130
  return output8
131
  time.sleep(1)
 
158
  with gr.Row():
159
  like_message = gr.Button("❤️ Press the Like Button if you enjoy my space! ❤️")
160
  with gr.Row():
161
+ output1=gr.Image(label="Dreamlike Diffusion 1.0")
162
+ output2=gr.Image(label="Dreamlike Diffusion 1.0")
163
  with gr.Row():
164
+ output3=gr.Image(label="Dreamlike Diffusion 1.0")
165
+ output4=gr.Image(label="Dreamlike Diffusion 1.0")
166
  with gr.Row():
167
  output5=gr.Image(label="Dreamlike Diffusion 1.0")
168
  output6=gr.Image(label="Dreamlike Diffusion 1.0")
 
186
  myface.queue(concurrency_count=8)
187
  myface.launch(enable_queue=True, inline=True)
188
  while True:
189
+ if queue.qsize() >= 15:
190
  queue.queue.clear()
191
  time.sleep(30)