EmanHassan26 commited on
Commit
572bbf8
·
verified ·
1 Parent(s): c79550e

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -19,6 +19,9 @@ print("Initializing Models (Florence-2 & )...")
19
  florence_model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-large", trust_remote_code=True, torch_dtype=torch_dtype).to(device).eval()
20
  florence_processor = AutoProcessor.from_pretrained("microsoft/Florence-2-large", trust_remote_code=True)
21
 
 
 
 
22
  # 1. Load the specific ControlNet adapter from Hugging Face
23
  controlnet_ids= ["lllyasviel/sd-controlnet-canny","lllyasviel/sd-controlnet-seg","lllyasviel/sd-controlnet-depth"]
24
 
@@ -26,6 +29,7 @@ controlnet_edge = ControlNetModel.from_pretrained(controlnet_ids[0],torch_dtype=
26
  controlnet_seg = ControlNetModel.from_pretrained(controlnet_ids[1],torch_dtype=torch.float16)
27
  controlnet_depth = ControlNetModel.from_pretrained(controlnet_ids[2],torch_dtype=torch.float16)
28
 
 
29
  pipe_edge = StableDiffusionControlNetPipeline.from_pretrained(
30
  "runwayml/stable-diffusion-v1-5", controlnet=controlnet_edge, torch_dtype=torch.float16).to("cuda")
31
 
@@ -35,8 +39,7 @@ pipe_seg = StableDiffusionControlNetPipeline.from_pretrained(
35
  pipe_depth = StableDiffusionControlNetPipeline.from_pretrained(
36
  "runwayml/stable-diffusion-v1-5", controlnet=controlnet_depth, torch_dtype=torch.float16).to("cuda")
37
 
38
- # Load a quick, highly accurate MiDaS model pipeline via torch hub
39
- midas = torch.hub.load("intel-isl/MiDaS", "MiDaS_small").to(device).eval()
40
 
41
 
42
 
 
19
  florence_model = AutoModelForCausalLM.from_pretrained("microsoft/Florence-2-large", trust_remote_code=True, torch_dtype=torch_dtype).to(device).eval()
20
  florence_processor = AutoProcessor.from_pretrained("microsoft/Florence-2-large", trust_remote_code=True)
21
 
22
+ # Load a quick, highly accurate MiDaS model pipeline via torch hub
23
+ midas = torch.hub.load("intel-isl/MiDaS", "MiDaS_small").to(device).eval()
24
+
25
  # 1. Load the specific ControlNet adapter from Hugging Face
26
  controlnet_ids= ["lllyasviel/sd-controlnet-canny","lllyasviel/sd-controlnet-seg","lllyasviel/sd-controlnet-depth"]
27
 
 
29
  controlnet_seg = ControlNetModel.from_pretrained(controlnet_ids[1],torch_dtype=torch.float16)
30
  controlnet_depth = ControlNetModel.from_pretrained(controlnet_ids[2],torch_dtype=torch.float16)
31
 
32
+
33
  pipe_edge = StableDiffusionControlNetPipeline.from_pretrained(
34
  "runwayml/stable-diffusion-v1-5", controlnet=controlnet_edge, torch_dtype=torch.float16).to("cuda")
35
 
 
39
  pipe_depth = StableDiffusionControlNetPipeline.from_pretrained(
40
  "runwayml/stable-diffusion-v1-5", controlnet=controlnet_depth, torch_dtype=torch.float16).to("cuda")
41
 
42
+
 
43
 
44
 
45