manavsarkar07 commited on
Commit
b8731d7
·
verified ·
1 Parent(s): 941b029

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +3 -2
app.py CHANGED
@@ -56,6 +56,7 @@ def index():
56
  async def create_upload_file(contents: Base64Data):
57
  try:
58
  # Read the file
 
59
  loaded_image = base64_to_cv2(contents.base64_data)
60
  detected_objects, out_im = predictor.recognize(loaded_image)
61
  age = detected_objects.ages[0]
@@ -64,14 +65,14 @@ async def create_upload_file(contents: Base64Data):
64
  df = DeepFace.find(img_path = contents, db_path = "dataset/",model_name ='GhostFaceNet', threshold=0.9)
65
 
66
  filename = df[0].head()['identity'][0]
67
-
68
 
69
  print(f"filename: {filename}")
70
 
71
  # Convert the image to base64
72
  base64_output = image_to_base64("dataset/" + filename)
73
 
74
-
75
  return JSONResponse(content={
76
  "celeb_image": base64_output,
77
  "celeb":df[0].head()['identity'][0], "res":{
 
56
  async def create_upload_file(contents: Base64Data):
57
  try:
58
  # Read the file
59
+ print("-----Starting Prediction----------")
60
  loaded_image = base64_to_cv2(contents.base64_data)
61
  detected_objects, out_im = predictor.recognize(loaded_image)
62
  age = detected_objects.ages[0]
 
65
  df = DeepFace.find(img_path = contents, db_path = "dataset/",model_name ='GhostFaceNet', threshold=0.9)
66
 
67
  filename = df[0].head()['identity'][0]
68
+ filename = filename.replace("\\", "/")
69
 
70
  print(f"filename: {filename}")
71
 
72
  # Convert the image to base64
73
  base64_output = image_to_base64("dataset/" + filename)
74
 
75
+ print("------Prediction Done-----------")
76
  return JSONResponse(content={
77
  "celeb_image": base64_output,
78
  "celeb":df[0].head()['identity'][0], "res":{