MAS-AI-0000 commited on
Commit
017803b
·
verified ·
1 Parent(s): 53c2986

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +2 -2
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.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.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)