Мой код ниже:
Код: Выделить всё
app = FastAPI()
class PatientAttendance(BaseModel):
apptslotduration: int
patientage: int
log_distance: float
pct_appts_missed: float
doc_no_show_rate: float
zip_no_show_rate: float
note_no_show_rate: float
type_no_show_rate: float
spec_type_no_show_rate: float
monthly_no_show_rate: float
seasonal_no_show_rate: float
dow_no_show_rate: float
clinic_no_show_rate: float
lead_time_in_days: int
groupedstarttime: int
priminsurance_no_show_rate: float
secondinsurance_no_show_rate: float
@app.post('/predict/')
def predict(features: PatientAttendance):
data = features
prediction = model.predict([[data]])
if prediction[0] == 0:
result = "Patient Show"
else:
result = "No-Show"
probability = model.predict_proba([[data]])
return {
'prediction': prediction,
'probability': probability
}
if __name__ == '__main__':
uvicorn.run(app, host="127.0.0.1", port=8000)
Код: Выделить всё
TypeError: float() argument must be a string or a number, not 'PatientAttendance'
Подробнее здесь: https://stackoverflow.com/questions/716 ... t-patienta