Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
|
@@ -54,7 +54,7 @@ async def predict(image: UploadFile = File(...)):
|
|
| 54 |
return PredictionResponse(predicted_class=prediction["predicted_class"], confidence=prediction["confidence"])
|
| 55 |
except Exception as e:
|
| 56 |
print(f"Error in image prediction: {e}")
|
| 57 |
-
return PredictionResponse(predicted_class="Unknown", confidence=0.
|
| 58 |
@app.post(
|
| 59 |
"/predict/text",
|
| 60 |
response_model=PredictionResponse,
|
|
@@ -74,4 +74,4 @@ async def predict_text_endpoint(payload: TextPredictionRequest = Body(...)):
|
|
| 74 |
except Exception as e:
|
| 75 |
# Return a fallback response in case of error
|
| 76 |
print(f"Error in text prediction: {e}")
|
| 77 |
-
return PredictionResponse(predicted_class="Human", confidence=0.
|
|
|
|
| 54 |
return PredictionResponse(predicted_class=prediction["predicted_class"], confidence=prediction["confidence"])
|
| 55 |
except Exception as e:
|
| 56 |
print(f"Error in image prediction: {e}")
|
| 57 |
+
return PredictionResponse(predicted_class="Unknown", confidence=0.5)
|
| 58 |
@app.post(
|
| 59 |
"/predict/text",
|
| 60 |
response_model=PredictionResponse,
|
|
|
|
| 74 |
except Exception as e:
|
| 75 |
# Return a fallback response in case of error
|
| 76 |
print(f"Error in text prediction: {e}")
|
| 77 |
+
return PredictionResponse(predicted_class="Human", confidence=0.5)
|