Abs6187 commited on
Commit
e95fcf4
Β·
verified Β·
1 Parent(s): 7219a1c

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +8 -6
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
- # UPDATED to use the faster Flash model
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
- probability_gauge = gr.Gauge(label="Churn Probability", value=0.0, show_label=True)
 
 
 
 
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 (UPDATED YEAR)
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.1.0
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