Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -344,31 +344,35 @@ def get_dropdown_choices():
|
|
| 344 |
# 5) Build Gradio UI (3 tabs)
|
| 345 |
# ============================================================
|
| 346 |
|
| 347 |
-
with gr.Blocks(
|
|
|
|
|
|
|
|
|
|
|
|
|
| 348 |
gr.Markdown(
|
| 349 |
"""
|
| 350 |
# 🏨 Hotel Booking Cancellation Prediction
|
| 351 |
This app runs the full pipeline and compares two models:
|
| 352 |
-
- **Python Random Forest**
|
| 353 |
-
- **R LASSO Logistic Regression
|
| 354 |
|
| 355 |
**Tabs**
|
| 356 |
-
1) Run
|
| 357 |
2) Results & Visualizations
|
| 358 |
3) Predict Cancellation Probability (both models)
|
| 359 |
"""
|
| 360 |
)
|
| 361 |
|
| 362 |
# -----------------------------
|
| 363 |
-
# TAB 1: Run
|
| 364 |
# -----------------------------
|
| 365 |
-
with gr.Tab("1
|
| 366 |
gr.Markdown("Run each step and inspect the execution logs.")
|
| 367 |
|
| 368 |
with gr.Row():
|
| 369 |
-
btn_data = gr.Button("Run
|
| 370 |
-
btn_py = gr.Button("Run
|
| 371 |
-
btn_r = gr.Button("Run
|
| 372 |
btn_all = gr.Button("Run All (1→2→3)")
|
| 373 |
|
| 374 |
log_box = gr.Textbox(
|
|
@@ -385,7 +389,7 @@ with gr.Blocks(title="Hotel Booking Cancellation Prediction") as demo:
|
|
| 385 |
# -----------------------------
|
| 386 |
# TAB 2: Results & Visualizations
|
| 387 |
# -----------------------------
|
| 388 |
-
with gr.Tab("2
|
| 389 |
gr.Markdown("Loads the latest saved artifacts from **artifacts/py/** and **artifacts/r/**.")
|
| 390 |
|
| 391 |
btn_refresh = gr.Button("Refresh Results")
|
|
@@ -423,7 +427,7 @@ with gr.Blocks(title="Hotel Booking Cancellation Prediction") as demo:
|
|
| 423 |
# -----------------------------
|
| 424 |
# TAB 3: Predict
|
| 425 |
# -----------------------------
|
| 426 |
-
with gr.Tab("3
|
| 427 |
gr.Markdown(
|
| 428 |
"Enter booking details and predict cancellation probability with **both models**.\n"
|
| 429 |
"Dropdown values are taken from the dataset categories."
|
|
|
|
| 344 |
# 5) Build Gradio UI (3 tabs)
|
| 345 |
# ============================================================
|
| 346 |
|
| 347 |
+
with gr.Blocks(
|
| 348 |
+
title="Hotel Booking Cancellation Prediction",
|
| 349 |
+
theme=gr.themes.Soft(primary_hue="blue"),
|
| 350 |
+
css=open("style.css").read()
|
| 351 |
+
) as demo:
|
| 352 |
gr.Markdown(
|
| 353 |
"""
|
| 354 |
# 🏨 Hotel Booking Cancellation Prediction
|
| 355 |
This app runs the full pipeline and compares two models:
|
| 356 |
+
- **Python : Random Forest**
|
| 357 |
+
- **R : LASSO Logistic Regression**
|
| 358 |
|
| 359 |
**Tabs**
|
| 360 |
+
1) Run Models
|
| 361 |
2) Results & Visualizations
|
| 362 |
3) Predict Cancellation Probability (both models)
|
| 363 |
"""
|
| 364 |
)
|
| 365 |
|
| 366 |
# -----------------------------
|
| 367 |
+
# TAB 1: Run Models
|
| 368 |
# -----------------------------
|
| 369 |
+
with gr.Tab("1. Run Model"):
|
| 370 |
gr.Markdown("Run each step and inspect the execution logs.")
|
| 371 |
|
| 372 |
with gr.Row():
|
| 373 |
+
btn_data = gr.Button("Run Data Creation")
|
| 374 |
+
btn_py = gr.Button("Run Python Analysis")
|
| 375 |
+
btn_r = gr.Button("Run R Analysis")
|
| 376 |
btn_all = gr.Button("Run All (1→2→3)")
|
| 377 |
|
| 378 |
log_box = gr.Textbox(
|
|
|
|
| 389 |
# -----------------------------
|
| 390 |
# TAB 2: Results & Visualizations
|
| 391 |
# -----------------------------
|
| 392 |
+
with gr.Tab("2. Results & Visualizations"):
|
| 393 |
gr.Markdown("Loads the latest saved artifacts from **artifacts/py/** and **artifacts/r/**.")
|
| 394 |
|
| 395 |
btn_refresh = gr.Button("Refresh Results")
|
|
|
|
| 427 |
# -----------------------------
|
| 428 |
# TAB 3: Predict
|
| 429 |
# -----------------------------
|
| 430 |
+
with gr.Tab("3. Predictor"):
|
| 431 |
gr.Markdown(
|
| 432 |
"Enter booking details and predict cancellation probability with **both models**.\n"
|
| 433 |
"Dropdown values are taken from the dataset categories."
|