IBM/MAX-Image-Caption-Generator

Add mime type inference when uploaded images are missing mime type

Opened this issue · 3 comments

#9 added error checking for file type, but did so using mime type. This means that uploads with missing mime type (mime type = None) will fail even if the image is valid. This was discovered and addressed by the web app in IBM/MAX-Image-Caption-Generator-Web-App#39

As per discussion in #9 we should look into adding the mime type fix in the model as well. This can either be done using the same method as the web app or by using the more robust python magic library.

@ajbozarth should this be closed via #9?

No this is a follow up to #9 but as referenced there we can close this as "will not fix" if we would rather not spend the dev time. This is a minor edge case that can be worked around client side when encountered (like we did in the web app).

Yes, I agree. A properly written web application should send the correct mimetype instead of compromising the stability of this model.