j-min commited on
Commit
9d658a2
β€’
1 Parent(s): 0d9c9f0

Update examples

Browse files
Files changed (1) hide show
  1. app.py +10 -5
app.py CHANGED
@@ -38,9 +38,14 @@ class Instance:
38
  ))
39
 
40
  def get_model(self):
41
- if self.loaded_model is None:
42
- self.loaded_model = self.load_model()
43
- return self.loaded_model
 
 
 
 
 
44
 
45
  def load_model(self, model_id='j-min/IterInpaint-CLEVR'):
46
  pipe = StableDiffusionInpaintPipeline.from_pretrained(model_id)
@@ -63,7 +68,7 @@ class Instance:
63
  # # xformers
64
  # pipe.enable_xformers_memory_efficient_attention()
65
 
66
- self.loaded_model = pipe
67
 
68
  instance = Instance()
69
  instance.load_model()
@@ -709,7 +714,7 @@ with Blocks(
709
  examples=[
710
  [
711
  "images/blank.png",
712
- "blue metal cube",
713
  ],
714
  [
715
  "images/blank.png",
 
38
  ))
39
 
40
  def get_model(self):
41
+ if self.pipe is None:
42
+ self.pipe = self.load_model()
43
+
44
+ if torch.cuda.is_available():
45
+ self.pipe.to("cuda")
46
+ print("Loaded model to GPU")
47
+
48
+ return self.pipe
49
 
50
  def load_model(self, model_id='j-min/IterInpaint-CLEVR'):
51
  pipe = StableDiffusionInpaintPipeline.from_pretrained(model_id)
 
68
  # # xformers
69
  # pipe.enable_xformers_memory_efficient_attention()
70
 
71
+ self.pipe = pipe
72
 
73
  instance = Instance()
74
  instance.load_model()
 
714
  examples=[
715
  [
716
  "images/blank.png",
717
+ "blue metal cube; red rubber sphere",
718
  ],
719
  [
720
  "images/blank.png",