alfredplpl commited on
Commit
6303ab5
1 Parent(s): de423d8

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -5
app.py CHANGED
@@ -13,15 +13,13 @@ feature_extractor = CLIPFeatureExtractor.from_pretrained(model_id)
13
 
14
  pipe = StableDiffusionPipeline.from_pretrained(
15
  model_id,
16
- #torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
17
- torch_dtype=torch.float16,
18
  scheduler=scheduler)
19
  pipe.enable_xformers_memory_efficient_attention()
20
 
21
  pipe_i2i = StableDiffusionImg2ImgPipeline.from_pretrained(
22
  model_id,
23
- #torch_dtype=torch.bfloat16 if torch.cuda.is_available() else torch.float32,
24
- torch_dtype=torch.float16,
25
  scheduler=scheduler,
26
  requires_safety_checker=False,
27
  safety_checker=None,
@@ -51,6 +49,10 @@ def inference(prompt, guidance, steps, image_size="Square", seed=0, img=None, st
51
  height=768
52
  width=1024
53
  #pipe.enable_attention_slicing()
 
 
 
 
54
  else:
55
  height=768
56
  width=768
@@ -199,7 +201,7 @@ with gr.Blocks(css=css) as demo:
199
  neg_prompt = gr.Textbox(label="Negative prompt", placeholder="What to exclude from the image")
200
  disable_auto_prompt_correction = gr.Checkbox(label="Disable auto prompt corretion.")
201
  with gr.Row():
202
- image_size=gr.Radio(["Portrait","Landscape","Square"])
203
  image_size.show_label=False
204
  image_size.value="Square"
205
 
 
13
 
14
  pipe = StableDiffusionPipeline.from_pretrained(
15
  model_id,
16
+ torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
 
17
  scheduler=scheduler)
18
  pipe.enable_xformers_memory_efficient_attention()
19
 
20
  pipe_i2i = StableDiffusionImg2ImgPipeline.from_pretrained(
21
  model_id,
22
+ torch_dtype=torch.float16 if torch.cuda.is_available() else torch.float32,
 
23
  scheduler=scheduler,
24
  requires_safety_checker=False,
25
  safety_checker=None,
 
49
  height=768
50
  width=1024
51
  #pipe.enable_attention_slicing()
52
+ elif(image_size=="Highreso."):
53
+ height=1024
54
+ width=1024
55
+ #pipe.enable_attention_slicing()
56
  else:
57
  height=768
58
  width=768
 
201
  neg_prompt = gr.Textbox(label="Negative prompt", placeholder="What to exclude from the image")
202
  disable_auto_prompt_correction = gr.Checkbox(label="Disable auto prompt corretion.")
203
  with gr.Row():
204
+ image_size=gr.Radio(["Portrait","Landscape","Square","Highreso."])
205
  image_size.show_label=False
206
  image_size.value="Square"
207