multimodalart HF staff commited on
Commit
d446cb0
1 Parent(s): 5eda4aa

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -6
app.py CHANGED
@@ -3,21 +3,19 @@ import numpy as np
3
  import random
4
  import torch
5
  from diffusers import StableDiffusion3Pipeline, SD3Transformer2DModel, FlowMatchEulerDiscreteScheduler
 
6
 
7
  device = "cuda" if torch.cuda.is_available() else "cpu"
8
  dtype = torch.float16
9
 
10
- repo = "diffusers-internal-dev/private-model"
11
- transformer_repo= "diffusers-internal-dev/pm-revamp"
12
 
13
- transformer = SD3Transformer2DModel.from_pretrained(transformer_repo, subfolder="transformer", torch_dtype=dtype)
14
-
15
- pipe = StableDiffusion3Pipeline.from_pretrained(repo, transformer=transformer, torch_dtype=torch.float16).to(device)
16
- pipe.scheduler = FlowMatchEulerDiscreteScheduler.from_config(pipe.scheduler.config, shift=3.0)
17
 
18
  MAX_SEED = np.iinfo(np.int32).max
19
  MAX_IMAGE_SIZE = 1344
20
 
 
21
  def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps, progress=gr.Progress(track_tqdm=True)):
22
 
23
  if randomize_seed:
 
3
  import random
4
  import torch
5
  from diffusers import StableDiffusion3Pipeline, SD3Transformer2DModel, FlowMatchEulerDiscreteScheduler
6
+ import spaces
7
 
8
  device = "cuda" if torch.cuda.is_available() else "cpu"
9
  dtype = torch.float16
10
 
11
+ repo = "stabilityai/stable-diffusion-3-medium"
 
12
 
13
+ pipe = StableDiffusion3Pipeline.from_pretrained(repo, torch_dtype=torch.float16).to(device)
 
 
 
14
 
15
  MAX_SEED = np.iinfo(np.int32).max
16
  MAX_IMAGE_SIZE = 1344
17
 
18
+ @spaces.GPU
19
  def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance_scale, num_inference_steps, progress=gr.Progress(track_tqdm=True)):
20
 
21
  if randomize_seed: