ChenyangSi commited on
Commit
a9684d6
·
1 Parent(s): 53cf0d7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -16
app.py CHANGED
@@ -6,15 +6,6 @@ from diffusers import StableDiffusionPipeline
6
  from free_lunch_utils import register_free_upblock2d, register_free_crossattn_upblock2d
7
 
8
 
9
- # model_id = "CompVis/stable-diffusion-v1-4"
10
- model_id = "./stable-diffusion-v1-4"
11
- pip_1_4 = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
12
- pip_1_4 = pip_1_4.to("cuda")
13
-
14
- # model_id = "runwayml/stable-diffusion-v1-5"
15
- model_id = "./stable-diffusion-v1-5"
16
- pip_1_5 = StableDiffusionPipeline.from_pretrained(model_id, torch_dtype=torch.float16)
17
- pip_1_5 = pip_1_5.to("cuda")
18
 
19
  # model_id = "stabilityai/stable-diffusion-2-1"
20
  model_id = "./stable-diffusion-2-1"
@@ -32,12 +23,14 @@ def infer(prompt, sd_options, seed, b1, b2, s1, s2):
32
  global seed_prev
33
  global sd_image_prev
34
 
35
- if sd_options == 'SD1.5':
36
- pip = pip_1_5
37
- elif sd_options == 'SD2.1':
38
- pip = pip_2_1
39
- else:
40
- pip = pip_1_4
 
 
41
 
42
  run_baseline = False
43
  if prompt != prompt_prev or sd_options != sd_options_prev or seed != seed_prev:
@@ -78,6 +71,9 @@ examples = [
78
  [
79
  "half human half cat, a human cat hybrid",
80
  ],
 
 
 
81
  ]
82
 
83
 
@@ -94,7 +90,7 @@ h1 {
94
 
95
  block = gr.Blocks(css='style.css')
96
 
97
- options = ['SD1.4', 'SD1.5', 'SD2.1']
98
 
99
  with block:
100
  gr.Markdown("SD vs. FreeU.")
 
6
  from free_lunch_utils import register_free_upblock2d, register_free_crossattn_upblock2d
7
 
8
 
 
 
 
 
 
 
 
 
 
9
 
10
  # model_id = "stabilityai/stable-diffusion-2-1"
11
  model_id = "./stable-diffusion-2-1"
 
23
  global seed_prev
24
  global sd_image_prev
25
 
26
+ # if sd_options == 'SD1.5':
27
+ # pip = pip_1_5
28
+ # elif sd_options == 'SD2.1':
29
+ # pip = pip_2_1
30
+ # else:
31
+ # pip = pip_1_4
32
+
33
+ pip = pip_2_1
34
 
35
  run_baseline = False
36
  if prompt != prompt_prev or sd_options != sd_options_prev or seed != seed_prev:
 
71
  [
72
  "half human half cat, a human cat hybrid",
73
  ],
74
+ [
75
+ "a drone flying over a snowy forest."
76
+ ],
77
  ]
78
 
79
 
 
90
 
91
  block = gr.Blocks(css='style.css')
92
 
93
+ options = ['SD2.1']
94
 
95
  with block:
96
  gr.Markdown("SD vs. FreeU.")