AlStable commited on
Commit
9d2fd29
1 Parent(s): a39f091

Update app.py

Browse files

torch.get_default_dtype()

following discussion
https://discuss.huggingface.co/t/using-the-prompt-to-switch-model/30039/16

Files changed (1) hide show
  1. app.py +2 -1
app.py CHANGED
@@ -1,6 +1,7 @@
1
  from diffusers import StableDiffusionPipeline
2
  import torch
3
  import gradio as gr
 
4
 
5
  models=[
6
  "ItsJayQz/Marvel_WhatIf_Diffusion",
@@ -15,7 +16,7 @@ models=[
15
 
16
  def TextToImage(Prompt,model):
17
  model_id = model
18
- pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
19
  pipe = pipe.to("cpu")
20
  prompt = Prompt
21
  image = pipe(prompt).images[0]
 
1
  from diffusers import StableDiffusionPipeline
2
  import torch
3
  import gradio as gr
4
+ import accelerate
5
 
6
  models=[
7
  "ItsJayQz/Marvel_WhatIf_Diffusion",
 
16
 
17
  def TextToImage(Prompt,model):
18
  model_id = model
19
+ pipe = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.get_default_dtype())
20
  pipe = pipe.to("cpu")
21
  prompt = Prompt
22
  image = pipe(prompt).images[0]