@app.post('/predict/image')
async def predict_api(file: UploadFile=File(...)):
    extension = (file.filename.split('.')[(- 1)] in ('jpg', 'jpeg', 'png'))
    print(file.filename)
    print(extension)
    if (not extension):
        return 'Image must be jpg or png format!'
    image = read_imagefile((await file.read()))
    prediction = predict(image)
    clase = prediction[0]['class']
    clase = clase.replace('_', ' ')
    print(clase)
    print('X')
    translation = translator.translate(clase, 'es')
    translation = translation.text
    print(translation)
    return translation
@app.post('/predict/image')
async def predict_api(file: UploadFile=File(...)):
    extension = (file.filename.split('.')[(- 1)] in ('jpg', 'jpeg', 'png'))
    print(file.filename)
    print(extension)
    if (not extension):
        return 'Image must be jpg or png format!'
    image = read_imagefile((await file.read()))
    prediction = predict(image)
    clase = prediction[0]['class']
    clase = clase.replace('_', ' ')
    print(clase)
    print('X')
    translation = translator.translate(clase, 'es')
    translation = translation.text
    print(translation)
    return translation