AP123 commited on
Commit
b2ef9b6
·
verified ·
1 Parent(s): 7c4604f

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -2
app.py CHANGED
@@ -53,11 +53,14 @@ def transform_image(face_image):
53
  style_image_path = "examples/soyjak2.jpg" # Ensure this path is correct
54
  style_image = Image.open(style_image_path).resize(desired_size, Image.LANCZOS).convert('RGB')
55
  style_image_tensor = transforms.ToTensor()(style_image).unsqueeze(0).to("cuda")
 
 
 
56
 
57
  # Perform the transformation using the configured pipeline
58
  image = pipeline(
59
  prompt="soyjak",
60
- ip_adapter_image=[style_image_tensor, transforms.ToTensor()(processed_face_image).unsqueeze(0).to("cuda")], # Ensure these are tensors
61
  negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality",
62
  num_inference_steps=30,
63
  generator=generator,
@@ -80,4 +83,4 @@ demo = gr.Interface(
80
  )
81
 
82
  demo.queue(max_size=20)
83
- demo.launch()
 
53
  style_image_path = "examples/soyjak2.jpg" # Ensure this path is correct
54
  style_image = Image.open(style_image_path).resize(desired_size, Image.LANCZOS).convert('RGB')
55
  style_image_tensor = transforms.ToTensor()(style_image).unsqueeze(0).to("cuda")
56
+
57
+ # Convert the processed face image to tensor and move to GPU
58
+ processed_face_image_tensor = transforms.ToTensor()(processed_face_image).unsqueeze(0).to("cuda")
59
 
60
  # Perform the transformation using the configured pipeline
61
  image = pipeline(
62
  prompt="soyjak",
63
+ ip_adapter_image=[style_image_tensor, processed_face_image_tensor], # Ensure these are tensors
64
  negative_prompt="monochrome, lowres, bad anatomy, worst quality, low quality",
65
  num_inference_steps=30,
66
  generator=generator,
 
83
  )
84
 
85
  demo.queue(max_size=20)
86
+ demo.launch()