404 error handler
Browse files
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 |
-
|
48 |
-
|
49 |
-
|
|
|
|
|
|
|
|
|
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)
|