msabonkudi commited on
Commit
1402482
·
verified ·
1 Parent(s): 6f246e5

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -28,12 +28,12 @@ def predict_object():
28
  result = predict_object_function(image_path)
29
  print(result)
30
  except RuntimeError as e:
31
- flash(f"An error occurred during prediction. Please try again. {str(e)})", 'danger')
32
- return redirect(url_for('predict_object_get'))
33
  except Exception as e:
34
  print(str(e))
35
- flash("An error occurred during prediction. Please try again")
36
- return redirect(url_for('predict_object_get'))
37
  finally:
38
  os.remove(image_path)
39
 
 
28
  result = predict_object_function(image_path)
29
  print(result)
30
  except RuntimeError as e:
31
+ text = f"{str(e)})", 'danger'
32
+ return {"response": text}
33
  except Exception as e:
34
  print(str(e))
35
+ text = "An error occurred during prediction. Please try again"
36
+ return {"response": text}
37
  finally:
38
  os.remove(image_path)
39