Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -24,13 +24,16 @@ def get_concat_h_cut(in1, in2):
|
|
24 |
return dst
|
25 |
|
26 |
|
27 |
-
def get_concat_v_cut(in1, in2):
|
28 |
im1=Image.open(in1)
|
29 |
-
im2=Image.open(in2)
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
34 |
return dst
|
35 |
|
36 |
|
@@ -140,17 +143,17 @@ def run_script(chat: list, height: int, width: int, check_b,check_h,check_t,wait
|
|
140 |
print (ea)
|
141 |
messages[ea].screenshot(f'{i}-{uid}-tmp.png')
|
142 |
messages[ea+1].screenshot(f'{i+1}-{uid}-tmp.png')
|
143 |
-
im_roll = get_concat_v_cut(f'{i}-{uid}-tmp.png',f'{i+1}-{uid}-tmp.png')
|
144 |
im_roll.save(f'comb{i}-{uid}-tmp.png')
|
145 |
out_box.append(f'comb{i}-{uid}-tmp.png')
|
146 |
except Exception:
|
147 |
mes="<center>Some blocks returned an error"
|
148 |
if out_box:
|
149 |
if len(out_box)>1:
|
150 |
-
im_roll = get_concat_v_cut(f'{out_box[0]}',f'{out_box[1]}')
|
151 |
im_roll.save(f'comb-{uid}-tmp.png')
|
152 |
for i in range(2,len(out_box)):
|
153 |
-
im_roll = get_concat_v_cut(f'comb-{uid}-tmp.png',f'{out_box[i]}')
|
154 |
im_roll.save(f'comb-{uid}-tmp.png')
|
155 |
out = f'comb-{uid}-tmp.png'
|
156 |
else:
|
|
|
24 |
return dst
|
25 |
|
26 |
|
27 |
+
def get_concat_v_cut(in1, in2, theme):
|
28 |
im1=Image.open(in1)
|
29 |
+
im2=Image.open(in2)
|
30 |
+
if theme=='dark':
|
31 |
+
color=(31,41,55)
|
32 |
+
if theme=='light':
|
33 |
+
color=(255,255,255)
|
34 |
+
dst = Image.new('RGB', (min(im1.width, im2.width), im1.height + im2.height+30),color=color)
|
35 |
+
dst.paste(im1, (0, 10))
|
36 |
+
dst.paste(im2, (0, im1.height+20))
|
37 |
return dst
|
38 |
|
39 |
|
|
|
143 |
print (ea)
|
144 |
messages[ea].screenshot(f'{i}-{uid}-tmp.png')
|
145 |
messages[ea+1].screenshot(f'{i+1}-{uid}-tmp.png')
|
146 |
+
im_roll = get_concat_v_cut(f'{i}-{uid}-tmp.png',f'{i+1}-{uid}-tmp.png',check_t)
|
147 |
im_roll.save(f'comb{i}-{uid}-tmp.png')
|
148 |
out_box.append(f'comb{i}-{uid}-tmp.png')
|
149 |
except Exception:
|
150 |
mes="<center>Some blocks returned an error"
|
151 |
if out_box:
|
152 |
if len(out_box)>1:
|
153 |
+
im_roll = get_concat_v_cut(f'{out_box[0]}',f'{out_box[1]}',check_t)
|
154 |
im_roll.save(f'comb-{uid}-tmp.png')
|
155 |
for i in range(2,len(out_box)):
|
156 |
+
im_roll = get_concat_v_cut(f'comb-{uid}-tmp.png',f'{out_box[i]}',check_t)
|
157 |
im_roll.save(f'comb-{uid}-tmp.png')
|
158 |
out = f'comb-{uid}-tmp.png'
|
159 |
else:
|