Cherryblade29 commited on
Commit
406ac00
·
verified ·
1 Parent(s): 41a92c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -5
app.py CHANGED
@@ -15,8 +15,9 @@ from diffusers import StableDiffusionXLPipeline
15
  import gradio as gr
16
  import gc
17
 
18
- device = "cuda"
19
- dtype = torch.float16
 
20
 
21
 
22
  css = """
@@ -75,7 +76,6 @@ def get_segmentation_pipeline(
75
 
76
 
77
  @torch.inference_mode()
78
- @spaces.GPU
79
  def segment_image(
80
  image: Image,
81
  image_processor: AutoImageProcessor,
@@ -120,7 +120,6 @@ def get_depth_pipeline():
120
 
121
 
122
  @torch.inference_mode()
123
- @spaces.GPU
124
  def get_depth_image(
125
  image: Image,
126
  feature_extractor: AutoImageProcessor,
@@ -188,7 +187,6 @@ class ControlNetDepthDesignModelMulti:
188
  self.control_items = ["windowpane;window", "door;double;door"]
189
  self.additional_quality_suffix = "interior design, 4K, high resolution, photorealistic"
190
 
191
- @spaces.GPU
192
  def generate_design(self, empty_room_image: Image, prompt: str, guidance_scale: int = 10, num_steps: int = 50, strength: float =0.9, img_size: int = 640) -> Image:
193
  """
194
  Given an image of an empty room and a prompt
 
15
  import gradio as gr
16
  import gc
17
 
18
+
19
+ device = "cuda" if torch.cuda.is_available() else "cpu"
20
+ dtype = torch.float16 if torch.cuda.is_available() else torch.float32
21
 
22
 
23
  css = """
 
76
 
77
 
78
  @torch.inference_mode()
 
79
  def segment_image(
80
  image: Image,
81
  image_processor: AutoImageProcessor,
 
120
 
121
 
122
  @torch.inference_mode()
 
123
  def get_depth_image(
124
  image: Image,
125
  feature_extractor: AutoImageProcessor,
 
187
  self.control_items = ["windowpane;window", "door;double;door"]
188
  self.additional_quality_suffix = "interior design, 4K, high resolution, photorealistic"
189
 
 
190
  def generate_design(self, empty_room_image: Image, prompt: str, guidance_scale: int = 10, num_steps: int = 50, strength: float =0.9, img_size: int = 640) -> Image:
191
  """
192
  Given an image of an empty room and a prompt