rphrp1985 commited on
Commit
ef90ebc
1 Parent(s): adc2760

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +15 -15
app.py CHANGED
@@ -10,12 +10,12 @@ import spaces
10
  device = "cuda" if torch.cuda.is_available() else "cpu"
11
  dtype = torch.float16
12
 
13
- repo = "dataautogpt3/OpenDalleV1.1"
14
  repo = "stabilityai/stable-diffusion-3-medium"
15
- repo="stabilityai/stable-diffusion-3-medium-tensorrt"
16
 
17
- pipe = StableDiffusion3Pipeline.from_pretrained(repo, torch_dtype=torch.float16).to(device)
18
- # pipeline = AutoPipelineForText2Image.from_pretrained(repo, torch_dtype=torch.float16).to('cuda')
19
 
20
 
21
  MAX_SEED = np.iinfo(np.int32).max
@@ -27,20 +27,20 @@ def infer(prompt, negative_prompt, seed, randomize_seed, width, height, guidance
27
  if randomize_seed:
28
  seed = random.randint(0, MAX_SEED)
29
 
30
- # generator = torch.Generator().manual_seed(seed)
31
- # image = pipeline(prompt).images[0]
32
 
33
 
34
 
35
- image = pipe(
36
- prompt = prompt,
37
- negative_prompt = negative_prompt,
38
- guidance_scale = guidance_scale,
39
- num_inference_steps = num_inference_steps,
40
- width = width,
41
- height = height,
42
- generator = generator
43
- ).images[0]
44
 
45
  return image, seed
46
 
 
10
  device = "cuda" if torch.cuda.is_available() else "cpu"
11
  dtype = torch.float16
12
 
13
+ # repo = "dataautogpt3/OpenDalleV1.1"
14
  repo = "stabilityai/stable-diffusion-3-medium"
15
+ # repo="stabilityai/stable-diffusion-3-medium-tensorrt"
16
 
17
+ # pipe = StableDiffusion3Pipeline.from_pretrained(repo, torch_dtype=torch.float16).to(device)
18
+ pipeline = AutoPipelineForText2Image.from_pretrained(repo, torch_dtype=torch.float16).to('cuda')
19
 
20
 
21
  MAX_SEED = np.iinfo(np.int32).max
 
27
  if randomize_seed:
28
  seed = random.randint(0, MAX_SEED)
29
 
30
+ generator = torch.Generator().manual_seed(seed)
31
+ image = pipeline(prompt).images[0]
32
 
33
 
34
 
35
+ # image = pipe(
36
+ # prompt = prompt,
37
+ # negative_prompt = negative_prompt,
38
+ # guidance_scale = guidance_scale,
39
+ # num_inference_steps = num_inference_steps,
40
+ # width = width,
41
+ # height = height,
42
+ # generator = generator
43
+ # ).images[0]
44
 
45
  return image, seed
46