Mbonea commited on
Commit
7abb821
·
1 Parent(s): e946d7d

404 error handler

Browse files
Files changed (1) hide show
  1. App/Generate/database/Vercel.py +7 -3
App/Generate/database/Vercel.py CHANGED
@@ -44,9 +44,13 @@ class AsyncImageGenerator:
44
  async def fetch_image_status(self, image_id):
45
  url = f"https://replicate.com/api/predictions/{image_id}"
46
  async with self.session.get(url) as response:
47
- response.raise_for_status()
48
- temp = await response.json()
49
- status = temp
 
 
 
 
50
  while status["status"] != "succeeded":
51
  try:
52
  status = await self._fetch_image_status(image_id)
 
44
  async def fetch_image_status(self, image_id):
45
  url = f"https://replicate.com/api/predictions/{image_id}"
46
  async with self.session.get(url) as response:
47
+ try:
48
+ response.raise_for_status()
49
+ temp = await response.json()
50
+ status = temp
51
+ except:
52
+ status["status"] = "404"
53
+
54
  while status["status"] != "succeeded":
55
  try:
56
  status = await self._fetch_image_status(image_id)