Overglitch commited on
Commit
d1fb757
verified
1 Parent(s): 2adc29d

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -2
app.py CHANGED
@@ -36,11 +36,13 @@ def predict_fingerprint(image):
36
  fingerprint_type = get_fingerprint_type(winner)
37
  return fingerprint_type
38
  except Exception as e:
 
39
  raise HTTPException(status_code=500, detail=str(e))
40
 
41
  def preprocess_image(image):
42
  # Guardar la imagen en formato TIFF
43
  image.save("temp_image.tif")
 
44
  # Aplicar el mismo preprocesamiento que a arco1.tif
45
  processed_image = representativo("temp_image.tif")
46
  # Redimensionar la imagen procesada para que coincida con las dimensiones esperadas por el modelo SOM
@@ -57,12 +59,14 @@ def get_fingerprint_type(winner):
57
  async def predict_fingerprint_api(file: UploadFile = File(...)):
58
  try:
59
  contents = await file.read()
60
- print(f"contents:\n{contents}")
61
  image = Image.open(BytesIO(contents))
62
- print(f"image:\n{image}")
63
  fingerprint_type = predict_fingerprint(image)
 
64
  return {"prediction": fingerprint_type}
65
  except Exception as e:
 
66
  raise HTTPException(status_code=500, detail=str(e))
67
 
68
  def sobel(I):
 
36
  fingerprint_type = get_fingerprint_type(winner)
37
  return fingerprint_type
38
  except Exception as e:
39
+ print("prediccion")
40
  raise HTTPException(status_code=500, detail=str(e))
41
 
42
  def preprocess_image(image):
43
  # Guardar la imagen en formato TIFF
44
  image.save("temp_image.tif")
45
+ print(f"se guard贸{image}")
46
  # Aplicar el mismo preprocesamiento que a arco1.tif
47
  processed_image = representativo("temp_image.tif")
48
  # Redimensionar la imagen procesada para que coincida con las dimensiones esperadas por el modelo SOM
 
59
  async def predict_fingerprint_api(file: UploadFile = File(...)):
60
  try:
61
  contents = await file.read()
62
+ print(f"contenido:\n{contents}")
63
  image = Image.open(BytesIO(contents))
64
+ print(f"imagen:\n{image}")
65
  fingerprint_type = predict_fingerprint(image)
66
+
67
  return {"prediction": fingerprint_type}
68
  except Exception as e:
69
+ print("api")
70
  raise HTTPException(status_code=500, detail=str(e))
71
 
72
  def sobel(I):