phenomenon1981 commited on
Commit
db49162
1 Parent(s): 9bfbff3

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +13 -10
app.py CHANGED
@@ -42,7 +42,7 @@ def add_random_noise(prompt, noise_level=0.07):
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(0.5)
46
  queue.put(prompt_with_noise)
47
  output1 = proc1(queue.get())
48
  return output1
@@ -50,7 +50,7 @@ def send_it1(inputs, noise_level, proc1=proc1):
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(0.5)
54
  queue.put(prompt_with_noise)
55
  output2 = proc1(queue.get())
56
  return output2
@@ -58,7 +58,7 @@ def send_it2(inputs, noise_level, proc1=proc1):
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(0.5)
62
  queue.put(prompt_with_noise)
63
  output3 = proc1(queue.get())
64
  return output3
@@ -66,7 +66,7 @@ def send_it3(inputs, noise_level, proc1=proc1):
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(0.5)
70
  queue.put(prompt_with_noise)
71
  output4 = proc1(queue.get())
72
  return output4
@@ -74,7 +74,7 @@ def send_it4(inputs, noise_level, proc1=proc1):
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(0.5)
78
  queue.put(prompt_with_noise)
79
  output5 = proc1(queue.get())
80
  return output5
@@ -82,7 +82,7 @@ def send_it5(inputs, noise_level, proc1=proc1):
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(0.5)
86
  queue.put(prompt_with_noise)
87
  output6 = proc1(queue.get())
88
  return output6
@@ -90,7 +90,7 @@ def send_it6(inputs, noise_level, proc1=proc1):
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(0.5)
94
  queue.put(prompt_with_noise)
95
  output7 = proc1(queue.get())
96
  return output7
@@ -98,14 +98,17 @@ def send_it7(inputs, noise_level, proc1=proc1):
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(0.5)
102
  queue.put(prompt_with_noise)
103
  output8 = proc1(queue.get())
104
  return output8
105
 
106
 
107
  def get_prompts(prompt_text):
108
- output = text_gen(prompt_text)
 
 
 
109
  return output
110
 
111
 
@@ -147,5 +150,5 @@ with gr.Blocks() as myface:
147
  see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
148
 
149
  myface.launch(enable_queue=True, inline=True)
150
- block.queue(concurrency_count=30, max_size=30).launch(max_threads=80)
151
  reset_queue_thread.join()
 
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(queue.get())
48
  return output1
 
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(queue.get())
56
  return output2
 
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(queue.get())
64
  return output3
 
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(queue.get())
72
  return output4
 
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(queue.get())
80
  return output5
 
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(queue.get())
88
  return output6
 
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(queue.get())
96
  return output7
 
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(queue.get())
104
  return output8
105
 
106
 
107
  def get_prompts(prompt_text):
108
+ while queue.qsize() >= queue_threshold:
109
+ time.sleep(2)
110
+ queue.put(prompt_text)
111
+ output = text_gen(queue.get())
112
  return output
113
 
114
 
 
150
  see_prompts.click(get_prompts, inputs=[input_text], outputs=[prompt])
151
 
152
  myface.launch(enable_queue=True, inline=True)
153
+ block.queue(concurrency_count=30, max_size=30)
154
  reset_queue_thread.join()