phenomenon1981 commited on
Commit
3f46fdd
1 Parent(s): 1b95351

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +18 -27
app.py CHANGED
@@ -40,83 +40,74 @@ def add_random_noise(prompt, noise_level=0.07):
40
 
41
 
42
  def send_it1(inputs, noise_level, proc1=proc1):
43
- global queue
44
  prompt_with_noise = add_random_noise(inputs, noise_level)
45
- queue.put(prompt_with_noise)
46
- while queue.qsize() > queue_threshold:
47
  time.sleep(1)
 
48
  output1 = proc1(queue.get())
49
  return output1
50
 
51
  def send_it2(inputs, noise_level, proc1=proc1):
52
- global queue
53
  prompt_with_noise = add_random_noise(inputs, noise_level)
54
- queue.put(prompt_with_noise)
55
- while queue.qsize() > queue_threshold:
56
  time.sleep(1)
 
57
  output2 = proc1(queue.get())
58
  return output2
59
 
60
  def send_it3(inputs, noise_level, proc1=proc1):
61
- global queue
62
  prompt_with_noise = add_random_noise(inputs, noise_level)
63
- queue.put(prompt_with_noise)
64
- while queue.qsize() > queue_threshold:
65
  time.sleep(1)
 
66
  output3 = proc1(queue.get())
67
  return output3
68
 
69
  def send_it4(inputs, noise_level, proc1=proc1):
70
- global queue
71
  prompt_with_noise = add_random_noise(inputs, noise_level)
72
- queue.put(prompt_with_noise)
73
- while queue.qsize() > queue_threshold:
74
  time.sleep(1)
 
75
  output4 = proc1(queue.get())
76
  return output4
77
 
78
  def send_it5(inputs, noise_level, proc1=proc1):
79
- global queue
80
  prompt_with_noise = add_random_noise(inputs, noise_level)
81
- queue.put(prompt_with_noise)
82
- while queue.qsize() > queue_threshold:
83
  time.sleep(1)
 
84
  output5 = proc1(queue.get())
85
  return output5
86
 
87
  def send_it6(inputs, noise_level, proc1=proc1):
88
- global queue
89
  prompt_with_noise = add_random_noise(inputs, noise_level)
90
- queue.put(prompt_with_noise)
91
- while queue.qsize() > queue_threshold:
92
  time.sleep(1)
 
93
  output6 = proc1(queue.get())
94
  return output6
95
 
96
  def send_it7(inputs, noise_level, proc1=proc1):
97
- global queue
98
  prompt_with_noise = add_random_noise(inputs, noise_level)
99
- queue.put(prompt_with_noise)
100
- while queue.qsize() > queue_threshold:
101
  time.sleep(1)
 
102
  output7 = proc1(queue.get())
103
  return output7
104
 
105
  def send_it8(inputs, noise_level, proc1=proc1):
106
- global queue
107
  prompt_with_noise = add_random_noise(inputs, noise_level)
108
- queue.put(prompt_with_noise)
109
- while queue.qsize() > queue_threshold:
110
  time.sleep(1)
 
111
  output8 = proc1(queue.get())
112
  return output8
113
 
114
 
115
  def get_prompts(prompt_text):
116
- global queue
117
- queue.put(prompt_text)
118
- while queue.qsize() > queue_threshold:
119
  time.sleep(1)
 
120
  output = text_gen(queue.get())
121
  return output
122
 
 
40
 
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(1)
46
+ queue.put(prompt_with_noise)
47
  output1 = proc1(queue.get())
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(1)
54
+ queue.put(prompt_with_noise)
55
  output2 = proc1(queue.get())
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(1)
62
+ queue.put(prompt_with_noise)
63
  output3 = proc1(queue.get())
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(1)
70
+ queue.put(prompt_with_noise)
71
  output4 = proc1(queue.get())
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(1)
78
+ queue.put(prompt_with_noise)
79
  output5 = proc1(queue.get())
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(1)
86
+ queue.put(prompt_with_noise)
87
  output6 = proc1(queue.get())
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(1)
94
+ queue.put(prompt_with_noise)
95
  output7 = proc1(queue.get())
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(1)
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(1)
110
+ queue.put(prompt_text)
111
  output = text_gen(queue.get())
112
  return output
113