ford442 commited on
Commit
9a2fe8f
·
1 Parent(s): e9b19af

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -5
app.py CHANGED
@@ -162,10 +162,7 @@ GPU_DURATION_OPTIONS = {
162
  "Long (140s)": 140,
163
  }
164
 
165
- def set_gpu_duration(duration_choice):
166
- os.environ["GPU_DURATION"] = str(GPU_DURATION_OPTIONS[duration_choice])
167
-
168
- @spaces.GPU(duration=int(os.getenv("GPU_DURATION", "60"))) # Dynamic duration
169
  def generate(
170
  model_choice: str,
171
  prompt: str,
@@ -185,7 +182,7 @@ def generate(
185
  global models
186
  pipe = models[model_choice]
187
  seed = int(randomize_seed_fn(seed, randomize_seed))
188
- generator = torch.Generator(device='cpu').manual_seed(seed)
189
 
190
  prompt, negative_prompt = apply_style(style_selection, prompt, negative_prompt)
191
 
@@ -269,6 +266,9 @@ def generate_cpu(
269
  image_paths = [save_image(img) for img in images]
270
  return image_paths, seed
271
 
 
 
 
272
  def load_predefined_images1():
273
  predefined_images1 = [
274
  "assets/7.png",
 
162
  "Long (140s)": 140,
163
  }
164
 
165
+ @spaces.GPU(duration=int(os.getenv("GPU_DURATION", "0"))) # Dynamic duration
 
 
 
166
  def generate(
167
  model_choice: str,
168
  prompt: str,
 
182
  global models
183
  pipe = models[model_choice]
184
  seed = int(randomize_seed_fn(seed, randomize_seed))
185
+ generator = torch.Generator(device='cuda').manual_seed(seed)
186
 
187
  prompt, negative_prompt = apply_style(style_selection, prompt, negative_prompt)
188
 
 
266
  image_paths = [save_image(img) for img in images]
267
  return image_paths, seed
268
 
269
+ def set_gpu_duration(duration_choice):
270
+ os.environ["GPU_DURATION"] = str(GPU_DURATION_OPTIONS[duration_choice])
271
+
272
  def load_predefined_images1():
273
  predefined_images1 = [
274
  "assets/7.png",