Omnibus commited on
Commit
a7b60fe
1 Parent(s): 05dd262

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +21 -2
app.py CHANGED
@@ -29,10 +29,20 @@ def make_files(t_name,t_space,t_title,t_description,t_redirect,t_image=None,t_im
29
  files=[]
30
  if t_image_url != None and t_image_url != "" and t_image==None:
31
  t_image=t_image_url
 
 
 
 
 
 
 
 
 
 
32
  t_image2=t_image.crop((0,140,500,140))
33
-
34
  print(f"Using image URL {t_image}")
35
  pass
 
36
  elif t_image != None:
37
  img1 = Image.open(t_image)
38
  img1.thumbnail((500,500), Image.Resampling.LANCZOS)
@@ -51,8 +61,17 @@ def make_files(t_name,t_space,t_title,t_description,t_redirect,t_image=None,t_im
51
  else:
52
  print("Default Image")
53
  t_image="https://huggingface.co/spaces/portal/bin/resolve/main/ai_demo_card.png"
 
 
 
 
 
 
 
 
 
 
54
  t_image2=t_image.crop((0,140,500,140))
55
- files.append(t_image)
56
  pass
57
 
58
  try:
 
29
  files=[]
30
  if t_image_url != None and t_image_url != "" and t_image==None:
31
  t_image=t_image_url
32
+ img1 = Image.open(t_image)
33
+ img1.thumbnail((500,500), Image.Resampling.LANCZOS)
34
+ img1.save(f'tmpim-{uid}.png')
35
+ output_pro=cv2.imread(f'tmpim-{uid}.png')
36
+ output_pro2=cv2.imread(f'tmpim2-{uid}.png')
37
+
38
+ cv2.imwrite("card_im.png",output_pro)
39
+ cv2.imwrite("card_im_crop.png",output_pro2)
40
+ files.append("card_im.png")
41
+ files.append("card_im_crop.png")
42
  t_image2=t_image.crop((0,140,500,140))
 
43
  print(f"Using image URL {t_image}")
44
  pass
45
+
46
  elif t_image != None:
47
  img1 = Image.open(t_image)
48
  img1.thumbnail((500,500), Image.Resampling.LANCZOS)
 
61
  else:
62
  print("Default Image")
63
  t_image="https://huggingface.co/spaces/portal/bin/resolve/main/ai_demo_card.png"
64
+ img1 = Image.open(t_image)
65
+ img1.thumbnail((500,500), Image.Resampling.LANCZOS)
66
+ img1.save(f'tmpim-{uid}.png')
67
+ output_pro=cv2.imread(f'tmpim-{uid}.png')
68
+ output_pro2=cv2.imread(f'tmpim2-{uid}.png')
69
+
70
+ cv2.imwrite("card_im.png",output_pro)
71
+ cv2.imwrite("card_im_crop.png",output_pro2)
72
+ files.append("card_im.png")
73
+ files.append("card_im_crop.png")
74
  t_image2=t_image.crop((0,140,500,140))
 
75
  pass
76
 
77
  try: