phenomenon1981 commited on
Commit
d2fbcff
1 Parent(s): f7ccecd

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +45 -45
app.py CHANGED
@@ -22,96 +22,96 @@ queue_length_counter = 0
22
  def send_it1(inputs, noise_level, proc1=proc1):
23
  global queue_length_counter
24
  prompt_with_noise = add_random_noise(inputs, noise_level)
25
- queue_length_counter += 1
26
- output1 = proc1(prompt_with_noise)
27
- queue_length_counter -= 1
28
- if queue_length_counter > 25:
29
- queue.queue.clear()
30
  queue_length_counter = 0
 
 
31
  time.sleep(1)
32
  return output1
33
 
34
  def send_it2(inputs, noise_level, proc1=proc1):
35
  global queue_length_counter
36
  prompt_with_noise = add_random_noise(inputs, noise_level)
37
- queue_length_counter += 1
38
- output2 = proc1(prompt_with_noise)
39
- queue_length_counter -= 1
40
- if queue_length_counter > 25:
41
- queue.queue.clear()
42
  queue_length_counter = 0
 
 
43
  time.sleep(1)
44
  return output2
45
 
46
  def send_it3(inputs, noise_level, proc1=proc1):
47
  global queue_length_counter
48
  prompt_with_noise = add_random_noise(inputs, noise_level)
49
- queue_length_counter += 1
50
- output3 = proc1(prompt_with_noise)
51
- queue_length_counter -= 1
52
- if queue_length_counter > 25:
53
- queue.queue.clear()
54
  queue_length_counter = 0
 
 
55
  time.sleep(1)
56
  return output3
57
 
58
  def send_it4(inputs, noise_level, proc1=proc1):
59
  global queue_length_counter
60
  prompt_with_noise = add_random_noise(inputs, noise_level)
61
- queue_length_counter += 1
62
- output4 = proc1(prompt_with_noise)
63
- queue_length_counter -= 1
64
- if queue_length_counter > 25:
65
- queue.queue.clear()
66
  queue_length_counter = 0
 
 
67
  time.sleep(1)
68
  return output4
69
 
70
  def send_it5(inputs, noise_level, proc5=proc5):
71
  global queue_length_counter
72
  prompt_with_noise = add_random_noise(inputs, noise_level)
73
- queue_length_counter += 1
74
- output5 = proc5(prompt_with_noise)
75
- queue_length_counter -= 1
76
- if queue_length_counter > 25:
77
- queue.queue.clear()
78
  queue_length_counter = 0
 
 
79
  time.sleep(1)
80
  return output5
81
 
82
  def send_it6(inputs, noise_level, proc5=proc5):
83
  global queue_length_counter
84
  prompt_with_noise = add_random_noise(inputs, noise_level)
85
- queue_length_counter += 1
86
- output6 = proc5(prompt_with_noise)
87
- queue_length_counter -= 1
88
- if queue_length_counter > 25:
89
- queue.queue.clear()
90
  queue_length_counter = 0
 
 
91
  time.sleep(1)
92
  return output6
93
 
94
  def send_it7(inputs, noise_level, proc5=proc5):
95
  global queue_length_counter
96
  prompt_with_noise = add_random_noise(inputs, noise_level)
97
- queue_length_counter += 1
98
- output7 = proc5(prompt_with_noise)
99
- queue_length_counter -= 1
100
- if queue_length_counter > 25:
101
- queue.queue.clear()
102
  queue_length_counter = 0
 
 
103
  time.sleep(1)
104
  return output7
105
 
106
  def send_it8(inputs, noise_level, proc5=proc5):
107
  global queue_length_counter
108
  prompt_with_noise = add_random_noise(inputs, noise_level)
109
- queue_length_counter += 1
110
- output8 = proc5(prompt_with_noise)
111
- queue_length_counter -= 1
112
- if queue_length_counter > 25:
113
- queue.queue.clear()
114
  queue_length_counter = 0
 
 
115
  time.sleep(1)
116
  return output8
117
 
@@ -119,12 +119,12 @@ def send_it8(inputs, noise_level, proc5=proc5):
119
 
120
  def get_prompts(prompt_text):
121
  global queue_length_counter
122
- queue_length_counter += 1
123
- output = text_gen(prompt_text)
124
- queue_length_counter -= 1
125
- if queue_length_counter > 25:
126
- queue.queue.clear()
127
  queue_length_counter = 0
 
 
128
  time.sleep(1)
129
  return output
130
 
 
22
  def send_it1(inputs, noise_level, proc1=proc1):
23
  global queue_length_counter
24
  prompt_with_noise = add_random_noise(inputs, noise_level)
25
+ if queue_length_counter >= 25:
26
+ if not queue.empty():
27
+ queue.queue.clear()
 
 
28
  queue_length_counter = 0
29
+ output1 = proc1(prompt_with_noise)
30
+ queue_length_counter += 1
31
  time.sleep(1)
32
  return output1
33
 
34
  def send_it2(inputs, noise_level, proc1=proc1):
35
  global queue_length_counter
36
  prompt_with_noise = add_random_noise(inputs, noise_level)
37
+ if queue_length_counter >= 25:
38
+ if not queue.empty():
39
+ queue.queue.clear()
 
 
40
  queue_length_counter = 0
41
+ output2 = proc1(prompt_with_noise)
42
+ queue_length_counter += 1
43
  time.sleep(1)
44
  return output2
45
 
46
  def send_it3(inputs, noise_level, proc1=proc1):
47
  global queue_length_counter
48
  prompt_with_noise = add_random_noise(inputs, noise_level)
49
+ if queue_length_counter >= 25:
50
+ if not queue.empty():
51
+ queue.queue.clear()
 
 
52
  queue_length_counter = 0
53
+ output3 = proc1(prompt_with_noise)
54
+ queue_length_counter += 1
55
  time.sleep(1)
56
  return output3
57
 
58
  def send_it4(inputs, noise_level, proc1=proc1):
59
  global queue_length_counter
60
  prompt_with_noise = add_random_noise(inputs, noise_level)
61
+ if queue_length_counter >= 25:
62
+ if not queue.empty():
63
+ queue.queue.clear()
 
 
64
  queue_length_counter = 0
65
+ output4 = proc1(prompt_with_noise)
66
+ queue_length_counter += 1
67
  time.sleep(1)
68
  return output4
69
 
70
  def send_it5(inputs, noise_level, proc5=proc5):
71
  global queue_length_counter
72
  prompt_with_noise = add_random_noise(inputs, noise_level)
73
+ if queue_length_counter >= 25:
74
+ if not queue.empty():
75
+ queue.queue.clear()
 
 
76
  queue_length_counter = 0
77
+ output5 = proc5(prompt_with_noise)
78
+ queue_length_counter += 1
79
  time.sleep(1)
80
  return output5
81
 
82
  def send_it6(inputs, noise_level, proc5=proc5):
83
  global queue_length_counter
84
  prompt_with_noise = add_random_noise(inputs, noise_level)
85
+ if queue_length_counter >= 25:
86
+ if not queue.empty():
87
+ queue.queue.clear()
 
 
88
  queue_length_counter = 0
89
+ output6 = proc5(prompt_with_noise)
90
+ queue_length_counter += 1
91
  time.sleep(1)
92
  return output6
93
 
94
  def send_it7(inputs, noise_level, proc5=proc5):
95
  global queue_length_counter
96
  prompt_with_noise = add_random_noise(inputs, noise_level)
97
+ if queue_length_counter >= 25:
98
+ if not queue.empty():
99
+ queue.queue.clear()
 
 
100
  queue_length_counter = 0
101
+ output7 = proc5(prompt_with_noise)
102
+ queue_length_counter += 1
103
  time.sleep(1)
104
  return output7
105
 
106
  def send_it8(inputs, noise_level, proc5=proc5):
107
  global queue_length_counter
108
  prompt_with_noise = add_random_noise(inputs, noise_level)
109
+ if queue_length_counter >= 25:
110
+ if not queue.empty():
111
+ queue.queue.clear()
 
 
112
  queue_length_counter = 0
113
+ output8 = proc5(prompt_with_noise)
114
+ queue_length_counter += 1
115
  time.sleep(1)
116
  return output8
117
 
 
119
 
120
  def get_prompts(prompt_text):
121
  global queue_length_counter
122
+ if queue_length_counter >= 25:
123
+ if not queue.empty():
124
+ queue.queue.clear()
 
 
125
  queue_length_counter = 0
126
+ output = text_gen(prompt_text)
127
+ queue_length_counter += 1
128
  time.sleep(1)
129
  return output
130