ameerazam08 commited on
Commit
bba9a52
·
verified ·
1 Parent(s): ad5855b

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -3
app.py CHANGED
@@ -262,15 +262,16 @@ for logo_id in all_sticker_id:
262
  def load_hf_image_and_json(image_url, json_url):
263
  """Loads an image from a Hugging Face URL and retrieves the associated JSON data."""
264
 
 
265
  image_response = requests.get(image_url)
266
 
267
 
 
268
  if image_response.status_code == 200:
269
  image = Image.open(io.BytesIO(image_response.content))
270
  else:
271
- image_url = image_url.replace('.jpeg','.png')
272
- image_response = requests.get(image_url)
273
- image = Image.open(io.BytesIO(image_response.content))
274
 
275
  # Load JSON Data
276
  json_response = requests.get(json_url)
 
262
  def load_hf_image_and_json(image_url, json_url):
263
  """Loads an image from a Hugging Face URL and retrieves the associated JSON data."""
264
 
265
+
266
  image_response = requests.get(image_url)
267
 
268
 
269
+
270
  if image_response.status_code == 200:
271
  image = Image.open(io.BytesIO(image_response.content))
272
  else:
273
+
274
+ raise ValueError(f"Failed to load image: {image_url}")
 
275
 
276
  # Load JSON Data
277
  json_response = requests.get(json_url)