AP123 commited on
Commit
305c867
·
verified ·
1 Parent(s): 8279f18

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -4,7 +4,7 @@ from PIL import Image
4
  from diffusers import AutoPipelineForText2Image, DDIMScheduler
5
  import numpy as np
6
  from torchvision import transforms
7
- import spaces # Make sure to import spaces
8
 
9
  # Initialize the pipeline
10
  pipeline = AutoPipelineForText2Image.from_pretrained(
@@ -47,10 +47,10 @@ def transform_image(face_image):
47
  if processed_face_image.mode == 'L':
48
  processed_face_image = processed_face_image.convert('RGB')
49
 
50
- # Resize the face image
51
  processed_face_image = processed_face_image.resize(desired_size, Image.LANCZOS)
52
 
53
- # Load the style image from the local path, resize it and convert to tensor
54
  style_image_path = "examples/soyjak2.jpg" # Ensure this path is correct
55
  style_image = Image.open(style_image_path).resize(desired_size, Image.LANCZOS)
56
  style_image_tensor = transforms.ToTensor()(style_image).unsqueeze(0).to("cuda")
@@ -81,4 +81,4 @@ demo = gr.Interface(
81
  )
82
 
83
  demo.queue(max_size=20)
84
- demo.launch()
 
4
  from diffusers import AutoPipelineForText2Image, DDIMScheduler
5
  import numpy as np
6
  from torchvision import transforms
7
+ import spaces
8
 
9
  # Initialize the pipeline
10
  pipeline = AutoPipelineForText2Image.from_pretrained(
 
47
  if processed_face_image.mode == 'L':
48
  processed_face_image = processed_face_image.convert('RGB')
49
 
50
+ # Resize the face image to 1024x1024
51
  processed_face_image = processed_face_image.resize(desired_size, Image.LANCZOS)
52
 
53
+ # Load the style image from the local path, resize it to 1024x1024, and convert to tensor
54
  style_image_path = "examples/soyjak2.jpg" # Ensure this path is correct
55
  style_image = Image.open(style_image_path).resize(desired_size, Image.LANCZOS)
56
  style_image_tensor = transforms.ToTensor()(style_image).unsqueeze(0).to("cuda")
 
81
  )
82
 
83
  demo.queue(max_size=20)
84
+ demo.launch()