Spaces:
Sleeping
Sleeping
Update app.py
Browse files
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 |
-
|
| 32 |
-
return
|
| 33 |
except Exception as e:
|
| 34 |
print(str(e))
|
| 35 |
-
|
| 36 |
-
return
|
| 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 |
|