Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -116,8 +116,7 @@ def predict_churn(customer_id, region, plan_type, monthly_charges, total_charges
|
|
| 116 |
print(f"Prediction error: {e}") # Log the real error for debugging
|
| 117 |
if GOOGLE_API_KEY:
|
| 118 |
try:
|
| 119 |
-
|
| 120 |
-
gemini_model = genai.GenerativeModel('gemini-2.5-flash')
|
| 121 |
prompt = f"""
|
| 122 |
An error occurred in a telecom churn prediction app. The technical error was: '{str(e)}'.
|
| 123 |
Generate a concise, friendly, non-technical message for the user.
|
|
@@ -177,7 +176,11 @@ with gr.Blocks(title="Telecom Churn Prediction - BRBRAITT Group 5", theme=gr.the
|
|
| 177 |
with gr.Column(scale=1):
|
| 178 |
gr.Markdown("### π Prediction Result")
|
| 179 |
prediction_output = gr.Markdown(value="*Results will be displayed here...*")
|
| 180 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
| 181 |
|
| 182 |
predict_btn.click(
|
| 183 |
fn=predict_churn,
|
|
@@ -225,7 +228,7 @@ with gr.Blocks(title="Telecom Churn Prediction - BRBRAITT Group 5", theme=gr.the
|
|
| 225 |
else:
|
| 226 |
gr.Markdown(f"*{title} - Image not available*")
|
| 227 |
|
| 228 |
-
# Tab 4: About Project
|
| 229 |
with gr.TabItem("βΉοΈ About"):
|
| 230 |
gr.Markdown("""
|
| 231 |
### π Academic Project Details
|
|
@@ -235,10 +238,9 @@ with gr.Blocks(title="Telecom Churn Prediction - BRBRAITT Group 5", theme=gr.the
|
|
| 235 |
- **Team (Group 5):** Abhay Gupta, Jay Kumar, Kripanshu Gupta, Ruhy Namdeo
|
| 236 |
- **Tech Stack:** Scikit-learn, Pandas, Gradio, Gemini, Hugging Face
|
| 237 |
---
|
| 238 |
-
**π Project Status:** Complete | **π
Last Updated:** October 2025 | **π’ Version:** 1.
|
| 239 |
""")
|
| 240 |
|
| 241 |
-
# Footer (UPDATED YEAR)
|
| 242 |
gr.Markdown("--- \n Β© 2025 BRBRAITT Group 5 | TIRTC Advance AI/ML Training")
|
| 243 |
|
| 244 |
# Launch the app
|
|
|
|
| 116 |
print(f"Prediction error: {e}") # Log the real error for debugging
|
| 117 |
if GOOGLE_API_KEY:
|
| 118 |
try:
|
| 119 |
+
gemini_model = genai.GenerativeModel('gemini-1.5-flash')
|
|
|
|
| 120 |
prompt = f"""
|
| 121 |
An error occurred in a telecom churn prediction app. The technical error was: '{str(e)}'.
|
| 122 |
Generate a concise, friendly, non-technical message for the user.
|
|
|
|
| 176 |
with gr.Column(scale=1):
|
| 177 |
gr.Markdown("### π Prediction Result")
|
| 178 |
prediction_output = gr.Markdown(value="*Results will be displayed here...*")
|
| 179 |
+
|
| 180 |
+
# ===== THIS IS THE FIX =====
|
| 181 |
+
# Replaced gr.Gauge with gr.Number to fix the crash
|
| 182 |
+
probability_gauge = gr.Number(label="Churn Probability", value=0.0, interactive=False)
|
| 183 |
+
# ==========================
|
| 184 |
|
| 185 |
predict_btn.click(
|
| 186 |
fn=predict_churn,
|
|
|
|
| 228 |
else:
|
| 229 |
gr.Markdown(f"*{title} - Image not available*")
|
| 230 |
|
| 231 |
+
# Tab 4: About Project
|
| 232 |
with gr.TabItem("βΉοΈ About"):
|
| 233 |
gr.Markdown("""
|
| 234 |
### π Academic Project Details
|
|
|
|
| 238 |
- **Team (Group 5):** Abhay Gupta, Jay Kumar, Kripanshu Gupta, Ruhy Namdeo
|
| 239 |
- **Tech Stack:** Scikit-learn, Pandas, Gradio, Gemini, Hugging Face
|
| 240 |
---
|
| 241 |
+
**π Project Status:** Complete | **π
Last Updated:** October 2025 | **π’ Version:** 1.2.0
|
| 242 |
""")
|
| 243 |
|
|
|
|
| 244 |
gr.Markdown("--- \n Β© 2025 BRBRAITT Group 5 | TIRTC Advance AI/ML Training")
|
| 245 |
|
| 246 |
# Launch the app
|