Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -11,6 +11,11 @@ import time
|
|
11 |
def load_data(dataset):
|
12 |
df = pd.read_csv(dataset)
|
13 |
return df
|
|
|
|
|
|
|
|
|
|
|
14 |
|
15 |
|
16 |
st.sidebar.image('images/diabetes.jpg',width=280)
|
@@ -61,7 +66,7 @@ def main():
|
|
61 |
sns.histplot(x='Glucose',data=data)
|
62 |
st.pyplot(fig)
|
63 |
with tab3:
|
64 |
-
model = pickle.load(open('./models/ada_dump.pkl', 'rb'))
|
65 |
prediction = model.predict(df)
|
66 |
pp = pd.DataFrame(prediction, columns=['Prediction'])
|
67 |
ndf = pd.concat([df, pp], axis=1)
|
@@ -70,12 +75,9 @@ def main():
|
|
70 |
st.header("📈🎯 Diabete Risk Prediction")
|
71 |
st.subheader("Predictions")
|
72 |
st.write(ndf)
|
73 |
-
|
74 |
-
b64 = base64.b64encode(csv.encode()).decode()
|
75 |
-
|
76 |
-
href = f'<a href="data:file/csv;base64,{b64}" download="Diabete_Prediction.csv">Download CSV file</a>'
|
77 |
if st.button(' 💾 Download csv file'):
|
78 |
-
st.markdown(
|
79 |
|
80 |
|
81 |
|
|
|
11 |
def load_data(dataset):
|
12 |
df = pd.read_csv(dataset)
|
13 |
return df
|
14 |
+
def filedownload(df):
|
15 |
+
csv = df.to_csv(index=False)
|
16 |
+
b64 = base64.b64encode(csv.encode()).decode() # strings <-> bytes conversions
|
17 |
+
href = f'<a href="data:file/csv;base64,{b64}" download="diabete_predictions.csv">Download CSV File</a>'
|
18 |
+
return href
|
19 |
|
20 |
|
21 |
st.sidebar.image('images/diabetes.jpg',width=280)
|
|
|
66 |
sns.histplot(x='Glucose',data=data)
|
67 |
st.pyplot(fig)
|
68 |
with tab3:
|
69 |
+
model = pickle.load(open('./models/ada_dump.pkl', 'rb')) # Load the trained model from disk
|
70 |
prediction = model.predict(df)
|
71 |
pp = pd.DataFrame(prediction, columns=['Prediction'])
|
72 |
ndf = pd.concat([df, pp], axis=1)
|
|
|
75 |
st.header("📈🎯 Diabete Risk Prediction")
|
76 |
st.subheader("Predictions")
|
77 |
st.write(ndf)
|
78 |
+
|
|
|
|
|
|
|
79 |
if st.button(' 💾 Download csv file'):
|
80 |
+
st.markdown(filedownload(ndf), unsafe_allow_html=True)
|
81 |
|
82 |
|
83 |
|