fffiloni commited on
Commit
877236b
1 Parent(s): 37aef88

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +9 -7
app.py CHANGED
@@ -2,6 +2,7 @@ import os
2
  import torch
3
  import random
4
  from PIL import Image
 
5
 
6
  import gradio as gr
7
  from glob import glob
@@ -206,18 +207,19 @@ class AnimateController:
206
  generator.manual_seed(seed)
207
 
208
 
209
- # Open the image
210
- image = Image.open(init_image).convert("RGB")
 
211
 
212
- # Resize the image
213
- image.resize((512, 512))
214
 
215
- # Save the resized image to the specified output path
216
- image.save("resized.jpg")
217
 
218
  sample = pipeline(
219
  prompt_textbox,
220
- init_image = "resized.jpg",
221
  negative_prompt = negative_prompt_textbox,
222
  num_inference_steps = 25,
223
  guidance_scale = 8.,
 
2
  import torch
3
  import random
4
  from PIL import Image
5
+ import cv2
6
 
7
  import gradio as gr
8
  from glob import glob
 
207
  generator.manual_seed(seed)
208
 
209
 
210
+
211
+ # Load the image
212
+ img = cv2.imread('image.jpg')
213
 
214
+ # Resize the image to (64, 64)
215
+ img = cv2.resize(img, (64, 64))
216
 
217
+ # Save the flattened image as a JPEG file
218
+ cv2.imwrite('resized_image.jpg', img)
219
 
220
  sample = pipeline(
221
  prompt_textbox,
222
+ init_image = "resized_image.jpg",
223
  negative_prompt = negative_prompt_textbox,
224
  num_inference_steps = 25,
225
  guidance_scale = 8.,