DeclK commited on
Commit
71b2f33
·
1 Parent(s): a4b0fcb

fix concat bug

Browse files
Files changed (1) hide show
  1. app.py +6 -6
app.py CHANGED
@@ -12,16 +12,16 @@ import cv2
12
  import gradio as gr
13
 
14
  def concat(img1, img2, height=1080):
15
- w1, h1, _ = img1.shape
16
- w2, h2, _ = img2.shape
17
 
18
  # Calculate the scaling factor for each image
19
- scale1 = height / img1.shape[1]
20
- scale2 = height / img2.shape[1]
21
 
22
  # Resize the images
23
- img1 = cv2.resize(img1, (int(h1*scale1), int(w1*scale1)))
24
- img2 = cv2.resize(img2, (int(h2*scale2), int(w2*scale2)))
25
 
26
  # Concatenate the images horizontally
27
  image = cv2.hconcat([img1, img2])
 
12
  import gradio as gr
13
 
14
  def concat(img1, img2, height=1080):
15
+ h1, w1, _ = img1.shape
16
+ h2, w2, _ = img2.shape
17
 
18
  # Calculate the scaling factor for each image
19
+ scale1 = height / img1.shape[0]
20
+ scale2 = height / img2.shape[0]
21
 
22
  # Resize the images
23
+ img1 = cv2.resize(img1, (int(w1*scale1), int(h1*scale1)))
24
+ img2 = cv2.resize(img2, (int(w2*scale2), int(h2*scale2)))
25
 
26
  # Concatenate the images horizontally
27
  image = cv2.hconcat([img1, img2])