OmPrakashSingh1704 commited on
Commit
2f1fa52
1 Parent(s): 41dca20
options/Banner_Model/Image2Image_2.py CHANGED
@@ -1,10 +1,7 @@
1
  import torch
2
  from controlnet_aux import LineartDetector
3
  from diffusers import ControlNetModel,UniPCMultistepScheduler,FluxPipeline
4
- from huggingface_hub import login
5
  from PIL import Image
6
- import os
7
- login(token=os.getenv("TOKEN"))
8
 
9
  device= "cuda" if torch.cuda.is_available() else "cpu"
10
  print("Using device for I2I_2:", device)
@@ -13,7 +10,7 @@ processor = LineartDetector.from_pretrained("lllyasviel/Annotators")
13
  checkpoint = "ControlNet-1-1-preview/control_v11p_sd15_lineart"
14
  controlnet = ControlNetModel.from_pretrained(checkpoint, torch_dtype=torch.float16).to(device)
15
  pipe = FluxPipeline.from_pretrained(
16
- "black-forest-labs/FLUX.1-dev", controlnet=controlnet, torch_dtype=torch.float16
17
  ).to(device)
18
  pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
19
  # pipe.enable_model_cpu_offload()
@@ -25,5 +22,4 @@ def I2I_2(image, prompt,size,num_inference_steps):
25
  image=processor(image)
26
  generator = torch.Generator(device=device).manual_seed(0)
27
  image = pipe(prompt, num_inference_steps=num_inference_steps, generator=generator, image=image).images[0]
28
- return image
29
-
 
1
  import torch
2
  from controlnet_aux import LineartDetector
3
  from diffusers import ControlNetModel,UniPCMultistepScheduler,FluxPipeline
 
4
  from PIL import Image
 
 
5
 
6
  device= "cuda" if torch.cuda.is_available() else "cpu"
7
  print("Using device for I2I_2:", device)
 
10
  checkpoint = "ControlNet-1-1-preview/control_v11p_sd15_lineart"
11
  controlnet = ControlNetModel.from_pretrained(checkpoint, torch_dtype=torch.float16).to(device)
12
  pipe = FluxPipeline.from_pretrained(
13
+ "benjamin-paine/stable-diffusion-v1-5", controlnet=controlnet, torch_dtype=torch.float16
14
  ).to(device)
15
  pipe.scheduler = UniPCMultistepScheduler.from_config(pipe.scheduler.config)
16
  # pipe.enable_model_cpu_offload()
 
22
  image=processor(image)
23
  generator = torch.Generator(device=device).manual_seed(0)
24
  image = pipe(prompt, num_inference_steps=num_inference_steps, generator=generator, image=image).images[0]
25
+ return image
 
options/Video_model/Model.py CHANGED
@@ -1,6 +1,6 @@
1
  import torch
2
  from diffusers import StableVideoDiffusionPipeline
3
- from diffusers.utils import load_image, save_video
4
  from PIL import Image
5
  from tdd_svd_scheduler import TDDSVDStochasticIterativeScheduler
6
  from utils import load_lora_weights, save_video
 
1
  import torch
2
  from diffusers import StableVideoDiffusionPipeline
3
+ from diffusers.utils import load_image
4
  from PIL import Image
5
  from tdd_svd_scheduler import TDDSVDStochasticIterativeScheduler
6
  from utils import load_lora_weights, save_video