Upload app.py
#1
by
						
KK00001
	
							
						- opened
							
					
    	
        app.py
    ADDED
    
    | @@ -0,0 +1,28 @@ | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | |
|  | 
|  | |
| 1 | 
            +
            import streamlit as st
         | 
| 2 | 
            +
            import numpy as np
         | 
| 3 | 
            +
            import joblib
         | 
| 4 | 
            +
             | 
| 5 | 
            +
            # ✅ Load Model & Scaler from Specific Path
         | 
| 6 | 
            +
            model_path = ("C:\\Users\\KAUSHIK\\OneDrive\\Documents\\lr.pkl")
         | 
| 7 | 
            +
            scaler_path = ("C:\\Users\\KAUSHIK\\OneDrive\\Documents\\scaler.pkl")
         | 
| 8 | 
            +
             | 
| 9 | 
            +
            lr = joblib.load(model_path)
         | 
| 10 | 
            +
            scaler = joblib.load(scaler_path)
         | 
| 11 | 
            +
             | 
| 12 | 
            +
            st.title("Diabetes Disease Progression Predictor")
         | 
| 13 | 
            +
            st.write("Enter the following patient details:")
         | 
| 14 | 
            +
             | 
| 15 | 
            +
            # Input Features
         | 
| 16 | 
            +
            features = ['age', 'sex', 'bmi', 'bp', 's1', 's2', 's3', 's4', 's5', 's6']
         | 
| 17 | 
            +
            inputs = []
         | 
| 18 | 
            +
             | 
| 19 | 
            +
            for feature in features:
         | 
| 20 | 
            +
                val = st.number_input(f"{feature}", value=0.0, step=0.01, format="%.2f")
         | 
| 21 | 
            +
                inputs.append(val)
         | 
| 22 | 
            +
             | 
| 23 | 
            +
            # Predict Button
         | 
| 24 | 
            +
            if st.button("Predict Disease Progression"):
         | 
| 25 | 
            +
                data = np.array([inputs])
         | 
| 26 | 
            +
                scaled_data = scaler.transform(data)
         | 
| 27 | 
            +
                prediction = lr.predict(scaled_data)
         | 
| 28 | 
            +
                st.success(f"Predicted Disease Progression Score: {prediction[0]:.2f}")
         | 
 
			
