patrickbdevaney commited on
Commit
4122838
·
verified ·
1 Parent(s): 4e91b3f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -17,6 +17,10 @@ from transformers import pipeline, AutoModelForCausalLM, AutoTokenizer
17
  import gradio as gr
18
  from accelerate import Accelerator
19
 
 
 
 
 
20
  # Instantiate the Accelerator
21
  accelerator = Accelerator()
22
 
@@ -88,8 +92,8 @@ paused = False
88
  parsed_descriptions_queue = deque()
89
 
90
  # Usage limits
91
- MAX_DESCRIPTIONS = 10
92
- MAX_IMAGES = 5
93
 
94
  @spaces.GPU
95
  def generate_descriptions(user_prompt, seed_words_input, batch_size=100, max_iterations=50):
@@ -165,7 +169,6 @@ def combined_function(user_prompt, seed_words_input):
165
  return images
166
 
167
  if __name__ == '__main__':
168
- mp.set_start_method('spawn')
169
  initialize_cuda()
170
 
171
  interface = gr.Interface(
@@ -174,5 +177,4 @@ if __name__ == '__main__':
174
  outputs=gr.Gallery()
175
  )
176
 
177
- interface.launch()
178
-
 
17
  import gradio as gr
18
  from accelerate import Accelerator
19
 
20
+ # Check if the start method has already been set
21
+ if mp.get_start_method(allow_none=True) != 'spawn':
22
+ mp.set_start_method('spawn')
23
+
24
  # Instantiate the Accelerator
25
  accelerator = Accelerator()
26
 
 
92
  parsed_descriptions_queue = deque()
93
 
94
  # Usage limits
95
+ MAX_DESCRIPTIONS = 30
96
+ MAX_IMAGES = 12
97
 
98
  @spaces.GPU
99
  def generate_descriptions(user_prompt, seed_words_input, batch_size=100, max_iterations=50):
 
169
  return images
170
 
171
  if __name__ == '__main__':
 
172
  initialize_cuda()
173
 
174
  interface = gr.Interface(
 
177
  outputs=gr.Gallery()
178
  )
179
 
180
+ interface.launch()