sohojoe commited on
Commit
6bf3b2e
1 Parent(s): fecbc09

debug urls

Browse files
Files changed (1) hide show
  1. app.py +27 -0
app.py CHANGED
@@ -103,6 +103,27 @@ def main(
103
  n_samples=4,
104
  ):
105
  debug_print("main")
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
106
 
107
  embeddings = base64_to_embedding(embeddings)
108
  # convert to python array
@@ -282,6 +303,12 @@ image_folder ="images"
282
  # "Prompt 3": "a person sitting on a bench using a cell phone",
283
 
284
  # }
 
 
 
 
 
 
285
 
286
  tabbed_examples = {
287
  "Pups": {
 
103
  n_samples=4,
104
  ):
105
  debug_print("main")
106
+ images = []
107
+ for url in test_images_urls:
108
+ import requests
109
+ from io import BytesIO
110
+ from PIL import Image
111
+ try:
112
+ response = requests.get(url)
113
+ if not response.ok:
114
+ continue
115
+ bytes = BytesIO(response.content)
116
+ image = Image.open(bytes)
117
+ if image.mode != 'RGB':
118
+ image = image.convert('RGB')
119
+ # width = 336
120
+ # aspect_ratio = float(image.height) / float(image.width)
121
+ # height = int(width * aspect_ratio)
122
+ # image = image.resize((width, height), Image.Resampling.LANCZOS)
123
+ images.append((image, "title"))
124
+ except Exception as e:
125
+ print(e)
126
+ return images
127
 
128
  embeddings = base64_to_embedding(embeddings)
129
  # convert to python array
 
303
  # "Prompt 3": "a person sitting on a bench using a cell phone",
304
 
305
  # }
306
+ test_images_urls = [
307
+ "https://www.mdig.com.br/imagens/bichos/caes_miniatura_chicara_07.jpg",
308
+ "https://i.pinimg.com/236x/04/ac/0e/04ac0e05964b75c9db59de94c571339e.jpg",
309
+ "https://i.pinimg.com/236x/a1/55/9e/a1559e56ae5fb6e4d19c43c6396b5940--teacup-yorkie-yorkie-puppy.jpg",
310
+ "https://i.pinimg.com/236x/11/c4/51/11c4518febb0869bd2b2d391d0753f44.jpg",
311
+ ]
312
 
313
  tabbed_examples = {
314
  "Pups": {