Spaces:
Sleeping
Sleeping
fahmiaziz98
commited on
Commit
·
540c05e
1
Parent(s):
ab29a0d
frist commit
Browse files- router/image_clf.py +3 -1
router/image_clf.py
CHANGED
@@ -7,6 +7,7 @@ from io import BytesIO
|
|
7 |
from fastapi import APIRouter, HTTPException
|
8 |
from scripts.data_model import ImageInput, ImageOutput
|
9 |
from utils.pipeline import load_model
|
|
|
10 |
|
11 |
router = APIRouter()
|
12 |
|
@@ -34,6 +35,7 @@ def image_classification(input: ImageInput)-> ImageOutput:
|
|
34 |
pipe = load_model(MODEL_PATH, is_image_model=True)
|
35 |
# image = download_image(input.url)
|
36 |
urls = [str(x) for x in input.url]
|
|
|
37 |
|
38 |
start = time.time()
|
39 |
output = pipe(urls)
|
@@ -52,4 +54,4 @@ def image_classification(input: ImageInput)-> ImageOutput:
|
|
52 |
)
|
53 |
|
54 |
except Exception as e:
|
55 |
-
return {"error": f"Failed to process
|
|
|
7 |
from fastapi import APIRouter, HTTPException
|
8 |
from scripts.data_model import ImageInput, ImageOutput
|
9 |
from utils.pipeline import load_model
|
10 |
+
from utils.log import logger
|
11 |
|
12 |
router = APIRouter()
|
13 |
|
|
|
35 |
pipe = load_model(MODEL_PATH, is_image_model=True)
|
36 |
# image = download_image(input.url)
|
37 |
urls = [str(x) for x in input.url]
|
38 |
+
logger.info(f"Image URLs: {urls}")
|
39 |
|
40 |
start = time.time()
|
41 |
output = pipe(urls)
|
|
|
54 |
)
|
55 |
|
56 |
except Exception as e:
|
57 |
+
return {"error": f"Failed to process image classification: {str(e)}"}, 500
|