Update My Project File.
Browse files
app.py
CHANGED
|
@@ -2,6 +2,8 @@ import gradio as gr
|
|
| 2 |
import pandas as pd
|
| 3 |
import pickle
|
| 4 |
|
|
|
|
|
|
|
| 5 |
# Load the model and encoder and scaler
|
| 6 |
model = pickle.load(open("model.pkl", "rb"))
|
| 7 |
encoder = pickle.load(open("encoder.pkl", "rb"))
|
|
@@ -80,32 +82,7 @@ def predict_churn(gender, SeniorCitizen, Partner, Dependents, tenure,
|
|
| 80 |
# Make prediction
|
| 81 |
prediction = model.predict(processed_df)
|
| 82 |
return "Churn" if prediction[0] == 1 else "No Churn"
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
# Add Image Tags
|
| 86 |
-
gr.Markdown(
|
| 87 |
-
"""
|
| 88 |
-
<div class="row">
|
| 89 |
-
<div class="column">
|
| 90 |
-
<img src="https://user-images.githubusercontent.com/115732734/271723332-6c824e95-5e2f-48ec-af1c-b66ac7db1d7a.jpeg" style="width:550"></div>
|
| 91 |
-
|
| 92 |
-
<div class="column">
|
| 93 |
-
<img src="https://user-images.githubusercontent.com/115732734/271723345-50f27ca9-94ee-4e7c-ad3b-2b10f27d31bb.jpeg" style="width:550"></div>
|
| 94 |
-
</div>
|
| 95 |
-
<style>
|
| 96 |
-
.row {
|
| 97 |
-
display: flex;
|
| 98 |
-
}
|
| 99 |
-
.column {
|
| 100 |
-
flex: 33.33%;
|
| 101 |
-
padding: 5px;
|
| 102 |
-
}
|
| 103 |
-
</style>
|
| 104 |
-
""",
|
| 105 |
-
unsafe_allow_html=True
|
| 106 |
-
)
|
| 107 |
-
|
| 108 |
-
|
| 109 |
# Launch the Gradio app
|
| 110 |
iface = gr.Interface(predict_churn, inputs=input_components, outputs=output_components)
|
| 111 |
iface.launch(inbrowser= True, show_error= True)
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
import pickle
|
| 4 |
|
| 5 |
+
IMAGENET_1K_URL ="https://user-images.githubusercontent.com/115732734/271723332-6c824e95-5e2f-48ec-af1c-b66ac7db1d7a.jpeg"
|
| 6 |
+
|
| 7 |
# Load the model and encoder and scaler
|
| 8 |
model = pickle.load(open("model.pkl", "rb"))
|
| 9 |
encoder = pickle.load(open("encoder.pkl", "rb"))
|
|
|
|
| 82 |
# Make prediction
|
| 83 |
prediction = model.predict(processed_df)
|
| 84 |
return "Churn" if prediction[0] == 1 else "No Churn"
|
| 85 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 86 |
# Launch the Gradio app
|
| 87 |
iface = gr.Interface(predict_churn, inputs=input_components, outputs=output_components)
|
| 88 |
iface.launch(inbrowser= True, show_error= True)
|