set image type on error
This commit is contained in:
parent
a34d2fb675
commit
42fcea85d3
@ -12,7 +12,6 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.imageio.ImageIO;
|
import javax.imageio.ImageIO;
|
||||||
import java.io.ByteArrayOutputStream;
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
@Slf4j
|
@Slf4j
|
||||||
@Service
|
@Service
|
||||||
@ -37,6 +36,7 @@ public class ImageClassificationService {
|
|||||||
image.setImageType(ImageType.valueOf(response.getCategory()));
|
image.setImageType(ImageType.valueOf(response.getCategory()));
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Could not classify image", e);
|
log.error("Could not classify image", e);
|
||||||
|
image.setImageType(ImageType.OTHER);
|
||||||
}
|
}
|
||||||
|
|
||||||
log.info("Image classification took: " + (System.currentTimeMillis() - start));
|
log.info("Image classification took: " + (System.currentTimeMillis() - start));
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user