Create new app issue

I’m deploying the new app i got error this “ValueError: dtype=‘numeric’ is not compatible with arrays of bytes/strings.Convert your data to numeric values explicitly instead.“but I change the code when I run streamlit server in my local machine the output will be show,but deploying the error I got errors like this” UserWarning: X does not have valid feature names, but LinearRegression was fitted with feature names” , please help me out and also provide my git repo link

There were some issues:

  • you feed strings instead of numeric values into the predictor
  • requirements outdated
  • unnecessary packages and imports

See my pull request on github, streamlit app should work now:

1 Like

Hello @vinod_kumar and @Franky1,
I am also getting the same error. Could you please help me out with this?
What did you do?

Can you send the git repository link

@vinod_kumar
Here is my GitHub link: Multiple Diseases Predictor
Here are the screenshots of the error:

@Ritu_Raj
Did yo get the answer for the error .
I am also facing same issue please help

In the numerical column your entered categorical data that’s why you get error

Where I did not understand

You need to read the traceback to figure out where in your code is the statement that triggers the error.

In heart disease prediction, your input should be numeric, but in your app, it will be categorical, so they get errors. Replace the text_input feature with a slider and you will get it. I will also share my git link for reference.
https://github.com/Vinodkumar-yerraballi/Heart-disease-prediction

Can u please provide conta t details

this is my file
please check this where is issue

(Attachment multiple disease.py is missing)

Heart Disease Prediction Page

if (selected == ‘Heart Disease Prediction’):

page title

st.title(‘Heart Disease Prediction using ML’)

col1, col2, col3 = st.columns(3)

with col1:
age = st.text_input(‘Age’)

with col2:
sex = st.text_input(‘Sex’)

with col3:
cp = st.text_input(‘Chest Pain types’)

with col1:
trestbps = st.text_input(‘Resting Blood Pressure’)

with col2:
chol = st.text_input(‘Serum Cholestoral in mg/dl’)

with col3:
fbs = st.text_input(‘Fasting Blood Sugar > 120 mg/dl’)

with col1:
restecg = st.text_input(‘Resting Electrocardiographic results’)

with col2:
thalach = st.text_input(‘Maximum Heart Rate achieved’)

with col3:
exang = st.text_input(‘Exercise Induced Angina’)

with col1:
oldpeak = st.text_input(‘ST depression induced by exercise’)

with col2:
slope = st.text_input(‘Slope of the peak exercise ST segment’)

with col3:
ca = st.text_input(‘Major vessels colored by flourosopy’)

with col1:
thal = st.text_input(‘thal: 0 = normal; 1 = fixed defect; 2 = reversable defect’)

code for Prediction

heart_diagnosis = ‘’

creating a button for Prediction

if st.button(‘Heart Disease Test Result’):
heart_prediction = heart_disease_model.predict([[age, sex, cp, trestbps, chol, fbs, restecg,thalach,exang,oldpeak,slope,ca,thal]])

if (heart_prediction[0] == 1):
heart_diagnosis = ‘The person is having heart disease’
else:
heart_diagnosis = ‘The person does not have any heart disease’

st.success(heart_diagnosis)

use st.number_input instead of st,text_input

Use st.number_input

You can check here GitHub - MutegiMk/MultipleDiseasesPrediction: This App Predict Three Different Diseases

use st.number_input

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.