Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -2408,23 +2408,25 @@ import base64
|
|
| 2408 |
|
| 2409 |
|
| 2410 |
|
|
|
|
|
|
|
| 2411 |
def reset_variables():
|
| 2412 |
-
|
| 2413 |
-
|
| 2414 |
-
|
| 2415 |
-
|
| 2416 |
-
|
| 2417 |
-
|
| 2418 |
def update_ai_dataset_selection(selection):
|
| 2419 |
-
|
| 2420 |
-
|
| 2421 |
-
|
| 2422 |
-
|
| 2423 |
-
|
| 2424 |
-
|
| 2425 |
-
|
| 2426 |
-
|
| 2427 |
-
|
| 2428 |
|
| 2429 |
placeholder_text = """"""
|
| 2430 |
|
|
@@ -2447,85 +2449,85 @@ Style:
|
|
| 2447 |
"""
|
| 2448 |
# Text input box for the user to enter their prompt
|
| 2449 |
prompt_textbox = gr.Textbox(
|
| 2450 |
-
|
| 2451 |
-
|
| 2452 |
-
|
| 2453 |
-
|
| 2454 |
)
|
| 2455 |
submit_button = gr.Button("Submit")
|
| 2456 |
bot = gr.Chatbot(placeholder=placeholder_text)
|
| 2457 |
|
| 2458 |
js_func = """
|
| 2459 |
function refresh() {
|
| 2460 |
-
|
| 2461 |
-
|
| 2462 |
-
|
| 2463 |
-
|
| 2464 |
-
|
| 2465 |
-
|
| 2466 |
-
|
| 2467 |
-
|
| 2468 |
-
|
| 2469 |
-
|
| 2470 |
-
|
| 2471 |
-
|
| 2472 |
-
|
| 2473 |
-
|
| 2474 |
-
|
| 2475 |
-
|
| 2476 |
-
|
| 2477 |
-
|
| 2478 |
-
|
| 2479 |
-
|
| 2480 |
-
|
| 2481 |
-
|
| 2482 |
-
|
| 2483 |
-
|
| 2484 |
-
|
| 2485 |
}
|
| 2486 |
"""
|
| 2487 |
|
| 2488 |
|
| 2489 |
css = """
|
| 2490 |
#vw_customers_btn, #vw_prospects_btn {
|
| 2491 |
-
|
| 2492 |
-
|
| 2493 |
-
|
| 2494 |
-
|
| 2495 |
-
|
| 2496 |
-
|
| 2497 |
-
|
| 2498 |
-
|
| 2499 |
-
|
| 2500 |
-
|
| 2501 |
-
|
| 2502 |
}
|
| 2503 |
|
| 2504 |
/* Highlighted (clicked) button — with teal text */
|
| 2505 |
.active-btn {
|
| 2506 |
-
|
| 2507 |
-
|
| 2508 |
-
|
| 2509 |
-
|
| 2510 |
}
|
| 2511 |
|
| 2512 |
/* Optional hover effect */
|
| 2513 |
#vw_customers_btn:hover, #vw_prospects_btn:hover {
|
| 2514 |
-
|
| 2515 |
}
|
| 2516 |
|
| 2517 |
.gr-button:has(svg) {
|
| 2518 |
-
|
| 2519 |
}
|
| 2520 |
.gr-image-label {
|
| 2521 |
-
|
| 2522 |
}
|
| 2523 |
#chat_container {
|
| 2524 |
-
|
| 2525 |
-
|
| 2526 |
-
|
| 2527 |
-
|
| 2528 |
-
|
| 2529 |
}
|
| 2530 |
"""
|
| 2531 |
|
|
@@ -2533,199 +2535,196 @@ css = """
|
|
| 2533 |
|
| 2534 |
|
| 2535 |
def highlight_button(button_name):
|
| 2536 |
-
|
| 2537 |
|
| 2538 |
# 🧠 Chatbot backend
|
| 2539 |
|
| 2540 |
|
| 2541 |
|
| 2542 |
def vwload_nps_and_r2(file_path):
|
| 2543 |
-
|
| 2544 |
-
|
| 2545 |
-
|
| 2546 |
|
| 2547 |
|
| 2548 |
|
| 2549 |
|
| 2550 |
def load_nps_and_r2(file_path):
|
| 2551 |
-
|
| 2552 |
-
|
| 2553 |
|
| 2554 |
-
|
| 2555 |
|
| 2556 |
|
| 2557 |
|
| 2558 |
with gr.Blocks(css=css, js=js_func) as demo:
|
| 2559 |
-
|
| 2560 |
-
|
| 2561 |
-
|
| 2562 |
-
|
| 2563 |
-
|
| 2564 |
-
|
| 2565 |
-
|
| 2566 |
-
|
| 2567 |
-
|
| 2568 |
-
|
| 2569 |
-
|
| 2570 |
-
|
| 2571 |
-
|
| 2572 |
-
|
| 2573 |
-
|
| 2574 |
-
|
| 2575 |
-
|
| 2576 |
-
|
| 2577 |
-
|
| 2578 |
-
|
| 2579 |
-
|
| 2580 |
-
|
| 2581 |
-
|
| 2582 |
-
|
| 2583 |
-
|
| 2584 |
-
|
| 2585 |
-
|
| 2586 |
-
|
| 2587 |
-
|
| 2588 |
-
|
| 2589 |
-
|
| 2590 |
-
|
| 2591 |
-
|
| 2592 |
-
|
| 2593 |
-
|
| 2594 |
-
|
| 2595 |
-
|
| 2596 |
-
|
| 2597 |
-
|
| 2598 |
-
|
| 2599 |
-
|
| 2600 |
-
|
| 2601 |
-
|
| 2602 |
-
|
| 2603 |
-
|
| 2604 |
-
|
| 2605 |
-
|
| 2606 |
-
|
| 2607 |
-
|
| 2608 |
-
|
| 2609 |
-
|
| 2610 |
-
|
| 2611 |
-
|
| 2612 |
-
|
| 2613 |
-
|
| 2614 |
-
|
| 2615 |
-
|
| 2616 |
-
|
| 2617 |
-
trust_r2_img = gr.HTML()
|
| 2618 |
-
|
| 2619 |
-
|
| 2620 |
-
with gr.Column():
|
| 2621 |
-
outputs = reset_outputs()
|
| 2622 |
-
|
| 2623 |
-
# 🔁 States
|
| 2624 |
-
vw_customers_state11 = gr.State(value=["example_files/VW Owners.xlsx"])
|
| 2625 |
-
vw_prospects_state12 = gr.State(value=["example_files/Volkswagen Non Customers.xlsx"])
|
| 2626 |
-
vw_customers_state = gr.State(value=["VW Owners.xlsx"])
|
| 2627 |
-
vw_prospects_state = gr.State(value=["Volkswagen Non Customers.xlsx"])
|
| 2628 |
-
selected_dataset_ai = gr.State(value="VW Owners.xlsx") # ✅ Matches dictionary key
|
| 2629 |
-
|
| 2630 |
-
chat_history = gr.State(value=[])
|
| 2631 |
|
| 2632 |
-
|
| 2633 |
-
|
| 2634 |
-
|
| 2635 |
-
|
| 2636 |
-
|
| 2637 |
-
|
| 2638 |
-
|
| 2639 |
-
|
| 2640 |
-
|
| 2641 |
-
|
| 2642 |
-
|
| 2643 |
-
|
| 2644 |
-
|
| 2645 |
-
|
| 2646 |
-
|
| 2647 |
-
|
| 2648 |
-
|
| 2649 |
-
|
| 2650 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2651 |
|
| 2652 |
|
| 2653 |
|
| 2654 |
-
|
| 2655 |
|
| 2656 |
-
|
| 2657 |
-
|
| 2658 |
-
|
| 2659 |
-
|
| 2660 |
-
|
| 2661 |
-
|
| 2662 |
-
|
| 2663 |
-
|
| 2664 |
-
|
| 2665 |
-
|
| 2666 |
-
|
| 2667 |
-
|
| 2668 |
-
|
| 2669 |
-
|
| 2670 |
-
|
| 2671 |
-
|
| 2672 |
-
|
| 2673 |
-
|
| 2674 |
-
|
| 2675 |
-
|
| 2676 |
-
|
| 2677 |
-
|
| 2678 |
-
|
| 2679 |
-
|
| 2680 |
-
|
| 2681 |
-
|
| 2682 |
-
|
| 2683 |
-
|
| 2684 |
|
| 2685 |
-
|
| 2686 |
-
|
| 2687 |
-
|
| 2688 |
-
|
| 2689 |
-
|
| 2690 |
-
|
| 2691 |
-
|
| 2692 |
-
|
| 2693 |
-
|
| 2694 |
-
|
| 2695 |
-
|
| 2696 |
-
|
| 2697 |
-
|
| 2698 |
-
|
| 2699 |
-
|
| 2700 |
-
|
| 2701 |
-
|
| 2702 |
-
|
| 2703 |
-
|
| 2704 |
-
|
| 2705 |
-
|
| 2706 |
-
|
| 2707 |
-
|
| 2708 |
-
|
| 2709 |
-
|
| 2710 |
-
|
| 2711 |
-
|
| 2712 |
-
|
| 2713 |
-
|
| 2714 |
-
|
| 2715 |
-
|
| 2716 |
-
|
| 2717 |
-
|
| 2718 |
-
|
| 2719 |
-
|
| 2720 |
-
|
| 2721 |
-
|
| 2722 |
-
|
| 2723 |
-
|
| 2724 |
-
|
| 2725 |
-
|
| 2726 |
-
|
| 2727 |
try:
|
| 2728 |
-
|
| 2729 |
except Exception as e:
|
| 2730 |
-
|
| 2731 |
-
|
|
|
|
| 2408 |
|
| 2409 |
|
| 2410 |
|
| 2411 |
+
import base64
|
| 2412 |
+
|
| 2413 |
def reset_variables():
|
| 2414 |
+
"""
|
| 2415 |
+
Reset global variables to handle dataset changes.
|
| 2416 |
+
"""
|
| 2417 |
+
global selected_dataset_ai
|
| 2418 |
+
selected_dataset_ai = None
|
| 2419 |
+
|
| 2420 |
def update_ai_dataset_selection(selection):
|
| 2421 |
+
global selected_dataset_ai # Ensure the global variable is updated
|
| 2422 |
+
reset_variables()
|
| 2423 |
+
chat_history.clear()
|
| 2424 |
+
|
| 2425 |
+
if selection == "VW Owners":
|
| 2426 |
+
selected_dataset_ai = vw_customers_state.value[0] # Use the customer dataset
|
| 2427 |
+
elif selection == "VW Prospects":
|
| 2428 |
+
selected_dataset_ai = vw_prospects_state.value[0] # Use the prospects dataset
|
| 2429 |
+
return selected_dataset_ai
|
| 2430 |
|
| 2431 |
placeholder_text = """"""
|
| 2432 |
|
|
|
|
| 2449 |
"""
|
| 2450 |
# Text input box for the user to enter their prompt
|
| 2451 |
prompt_textbox = gr.Textbox(
|
| 2452 |
+
value=predefined_prompt,
|
| 2453 |
+
scale=4,
|
| 2454 |
+
label="Insert your prompt",
|
| 2455 |
+
visible=True,
|
| 2456 |
)
|
| 2457 |
submit_button = gr.Button("Submit")
|
| 2458 |
bot = gr.Chatbot(placeholder=placeholder_text)
|
| 2459 |
|
| 2460 |
js_func = """
|
| 2461 |
function refresh() {
|
| 2462 |
+
// Force light theme if not already
|
| 2463 |
+
const url = new URL(window.location);
|
| 2464 |
+
if (url.searchParams.get('__theme') !== 'light') {
|
| 2465 |
+
url.searchParams.set('__theme', 'light');
|
| 2466 |
+
window.location.href = url.href;
|
| 2467 |
+
return;
|
| 2468 |
+
}
|
| 2469 |
+
|
| 2470 |
+
// Highlight toggle
|
| 2471 |
+
const btn1 = document.querySelector("#vw_customers_btn");
|
| 2472 |
+
const btn2 = document.querySelector("#vw_prospects_btn");
|
| 2473 |
+
|
| 2474 |
+
if (btn1 && btn2) {
|
| 2475 |
+
btn1.classList.add("active-btn"); // Default on load
|
| 2476 |
+
|
| 2477 |
+
btn1.addEventListener("click", () => {
|
| 2478 |
+
btn1.classList.add("active-btn");
|
| 2479 |
+
btn2.classList.remove("active-btn");
|
| 2480 |
+
});
|
| 2481 |
+
|
| 2482 |
+
btn2.addEventListener("click", () => {
|
| 2483 |
+
btn2.classList.add("active-btn");
|
| 2484 |
+
btn1.classList.remove("active-btn");
|
| 2485 |
+
});
|
| 2486 |
+
}
|
| 2487 |
}
|
| 2488 |
"""
|
| 2489 |
|
| 2490 |
|
| 2491 |
css = """
|
| 2492 |
#vw_customers_btn, #vw_prospects_btn {
|
| 2493 |
+
border: 2px solid #ccc;
|
| 2494 |
+
padding: 10px 20px;
|
| 2495 |
+
font-size: 16px;
|
| 2496 |
+
font-weight: 500;
|
| 2497 |
+
border-radius: 6px;
|
| 2498 |
+
color: #333;
|
| 2499 |
+
background-color: #fff;
|
| 2500 |
+
margin: 0 5px;
|
| 2501 |
+
transition: all 0.25s ease;
|
| 2502 |
+
min-width: 140px;
|
| 2503 |
+
text-align: center;
|
| 2504 |
}
|
| 2505 |
|
| 2506 |
/* Highlighted (clicked) button — with teal text */
|
| 2507 |
.active-btn {
|
| 2508 |
+
background-color: #e0f7f5 !important; /* Light teal background */
|
| 2509 |
+
color: teal !important; /* Teal text */
|
| 2510 |
+
border-color: teal !important;
|
| 2511 |
+
box-shadow: 0 0 6px rgba(0, 128, 128, 0.3);
|
| 2512 |
}
|
| 2513 |
|
| 2514 |
/* Optional hover effect */
|
| 2515 |
#vw_customers_btn:hover, #vw_prospects_btn:hover {
|
| 2516 |
+
background-color: #f9f9f9;
|
| 2517 |
}
|
| 2518 |
|
| 2519 |
.gr-button:has(svg) {
|
| 2520 |
+
display: none !important;
|
| 2521 |
}
|
| 2522 |
.gr-image-label {
|
| 2523 |
+
display: none !important;
|
| 2524 |
}
|
| 2525 |
#chat_container {
|
| 2526 |
+
max-height: 900px;
|
| 2527 |
+
overflow-y: auto;
|
| 2528 |
+
margin-top: 0 !important;
|
| 2529 |
+
margin-bottom: 0 !important;
|
| 2530 |
+
padding-bottom: 0 !important;
|
| 2531 |
}
|
| 2532 |
"""
|
| 2533 |
|
|
|
|
| 2535 |
|
| 2536 |
|
| 2537 |
def highlight_button(button_name):
|
| 2538 |
+
return gr.Button.update(variant="primary")
|
| 2539 |
|
| 2540 |
# 🧠 Chatbot backend
|
| 2541 |
|
| 2542 |
|
| 2543 |
|
| 2544 |
def vwload_nps_and_r2(file_path):
|
| 2545 |
+
nps_img = calculate_nps_image_from_excel(file_path)
|
| 2546 |
+
r2_img = vwcalculate_r2_image_from_excel(file_path)
|
| 2547 |
+
return nps_img,r2_img
|
| 2548 |
|
| 2549 |
|
| 2550 |
|
| 2551 |
|
| 2552 |
def load_nps_and_r2(file_path):
|
| 2553 |
+
nps_img = calculate_nps_image_from_excel(file_path)
|
| 2554 |
+
r2_img = calculate_r2_image_from_excel(file_path)
|
| 2555 |
|
| 2556 |
+
return nps_img, r2_img
|
| 2557 |
|
| 2558 |
|
| 2559 |
|
| 2560 |
with gr.Blocks(css=css, js=js_func) as demo:
|
| 2561 |
+
gr.HTML("""
|
| 2562 |
+
<style>
|
| 2563 |
+
#trust_driver_img, #nps_driver_img {
|
| 2564 |
+
display: inline-block;
|
| 2565 |
+
width: 49%;
|
| 2566 |
+
margin-right: 1%;
|
| 2567 |
+
vertical-align: top;
|
| 2568 |
+
}
|
| 2569 |
+
</style>
|
| 2570 |
+
""")
|
| 2571 |
+
|
| 2572 |
+
# 🔁 States (moved to top)
|
| 2573 |
+
vw_customers_state11 = gr.State(value=["example_files/VW Owners.xlsx"])
|
| 2574 |
+
vw_prospects_state12 = gr.State(value=["example_files/Volkswagen Non Customers.xlsx"])
|
| 2575 |
+
vw_customers_state = gr.State(value=["VW Owners.xlsx"])
|
| 2576 |
+
vw_prospects_state = gr.State(value=["Volkswagen Non Customers.xlsx"])
|
| 2577 |
+
selected_dataset_ai = gr.State(value="VW Owners.xlsx") # ✅ Matches dictionary key
|
| 2578 |
+
chat_history = gr.State(value=[])
|
| 2579 |
+
data_visible_state = gr.State(value=False)
|
| 2580 |
+
|
| 2581 |
+
# Title and intro
|
| 2582 |
+
with gr.Column():
|
| 2583 |
+
gr.Markdown("""
|
| 2584 |
+
<h2 style="text-align: center; font-size: 2.25rem; font-weight: 600;">
|
| 2585 |
+
TrustLogic AI Demo
|
| 2586 |
+
</h2>
|
| 2587 |
+
""")
|
| 2588 |
+
gr.Markdown("### Experience TrustLogic AI")
|
| 2589 |
+
gr.Markdown("Experience how quick and easy it is to build the right trust based on insight with our TrustLogic AI")
|
| 2590 |
+
|
| 2591 |
+
# Dataset selection buttons
|
| 2592 |
+
with gr.Column():
|
| 2593 |
+
with gr.Row():
|
| 2594 |
+
vw_customers_btn = gr.Button("VW Owners", elem_id="vw_customers_btn")
|
| 2595 |
+
vw_prospects_btn = gr.Button("VW Prospects", elem_id="vw_prospects_btn")
|
| 2596 |
+
|
| 2597 |
+
# 🧠 Chat section (moved to top)
|
| 2598 |
+
with gr.Column(elem_id="chat_container"):
|
| 2599 |
+
prompt_textbox = gr.Textbox(value=predefined_prompt, scale=4, label="Insert your prompt", visible=True)
|
| 2600 |
+
submit_button = gr.Button("Submit")
|
| 2601 |
+
bot = gr.Chatbot(placeholder=placeholder_text)
|
| 2602 |
+
|
| 2603 |
+
# Button to show data
|
| 2604 |
+
show_data_btn = gr.Button("Show the data", variant="primary", size="lg")
|
| 2605 |
+
|
| 2606 |
+
# Data analysis section (initially hidden)
|
| 2607 |
+
with gr.Column(visible=False) as data_section:
|
| 2608 |
+
gr.Markdown("### Uncover the underlying data used for the prompt")
|
| 2609 |
+
gr.Markdown("Quickly identify what drives your NPS and trust across different segments using the automated analyser.")
|
| 2610 |
+
gr.Markdown("""
|
| 2611 |
+
<span style="font-size:15px;">Volkswagen Example</span><br>
|
| 2612 |
+
As a default, the analysis displays <strong>Volkswagen Owner</strong> results.
|
| 2613 |
+
To trigger the analysis for <strong>Prospects</strong>, toggle to 'VW Prospects'.
|
| 2614 |
+
""")
|
| 2615 |
+
|
| 2616 |
+
with gr.Row(equal_height=True):
|
| 2617 |
+
with gr.Column(scale=1):
|
| 2618 |
+
nps_img_output = gr.HTML()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 2619 |
|
| 2620 |
+
|
| 2621 |
+
|
| 2622 |
+
with gr.Column(scale=1):
|
| 2623 |
+
trust_score_output = gr.HTML()
|
| 2624 |
+
|
| 2625 |
+
with gr.Column(scale=1):
|
| 2626 |
+
gr.Markdown("""<div style='text-align: center;'><h3>How much of your NPS is determined by TrustLogic®</h3></div>""")
|
| 2627 |
+
trust_r2_img = gr.HTML()
|
| 2628 |
+
|
| 2629 |
+
|
| 2630 |
+
with gr.Column():
|
| 2631 |
+
outputs = reset_outputs()
|
| 2632 |
+
|
| 2633 |
+
# Show/hide data section functionality
|
| 2634 |
+
def toggle_data_section(visible):
|
| 2635 |
+
new_visible = not visible
|
| 2636 |
+
button_text = "Hide the data" if new_visible else "Show the data"
|
| 2637 |
+
return gr.update(visible=new_visible), button_text, new_visible
|
| 2638 |
+
|
| 2639 |
+
show_data_btn.click(
|
| 2640 |
+
fn=toggle_data_section,
|
| 2641 |
+
inputs=data_visible_state,
|
| 2642 |
+
outputs=[data_section, show_data_btn, data_visible_state]
|
| 2643 |
+
)
|
| 2644 |
+
|
| 2645 |
+
submit_button.click(
|
| 2646 |
+
fn=chatbot_response,
|
| 2647 |
+
inputs=[prompt_textbox, chat_history, selected_dataset_ai],
|
| 2648 |
+
outputs=[bot, chat_history]
|
| 2649 |
+
)
|
| 2650 |
|
| 2651 |
|
| 2652 |
|
| 2653 |
+
## All widget functions here ##
|
| 2654 |
|
| 2655 |
+
vw_customers_btn.click(
|
| 2656 |
+
fn=display_trust_score_1,
|
| 2657 |
+
inputs=[],
|
| 2658 |
+
outputs=trust_score_output,
|
| 2659 |
+
)
|
| 2660 |
+
|
| 2661 |
+
vw_prospects_btn.click(
|
| 2662 |
+
fn=display_trust_score_2,
|
| 2663 |
+
inputs=[],
|
| 2664 |
+
outputs=trust_score_output,
|
| 2665 |
+
)
|
| 2666 |
+
|
| 2667 |
+
vw_customers_btn.click(
|
| 2668 |
+
fn=process_examples,
|
| 2669 |
+
inputs=[vw_customers_state],
|
| 2670 |
+
outputs= outputs,
|
| 2671 |
+
)
|
| 2672 |
+
|
| 2673 |
+
vw_prospects_btn.click(
|
| 2674 |
+
fn=process_examples,
|
| 2675 |
+
inputs=[vw_prospects_state],
|
| 2676 |
+
outputs= outputs,
|
| 2677 |
+
)
|
| 2678 |
+
def set_vw_owners():
|
| 2679 |
+
return "VW Owners.xlsx"
|
| 2680 |
+
|
| 2681 |
+
def set_vw_prospects():
|
| 2682 |
+
return "Volkswagen Non Customers.xlsx"
|
| 2683 |
|
| 2684 |
+
|
| 2685 |
+
vw_customers_btn.click(
|
| 2686 |
+
fn=set_vw_owners,
|
| 2687 |
+
inputs=[],
|
| 2688 |
+
outputs=selected_dataset_ai
|
| 2689 |
+
)
|
| 2690 |
+
|
| 2691 |
+
vw_prospects_btn.click(
|
| 2692 |
+
fn=set_vw_prospects,
|
| 2693 |
+
inputs=[],
|
| 2694 |
+
outputs=selected_dataset_ai
|
| 2695 |
+
)
|
| 2696 |
+
vw_customers_btn.click(
|
| 2697 |
+
fn=lambda f: vwload_nps_and_r2(f[0]),
|
| 2698 |
+
inputs=[vw_customers_state11],
|
| 2699 |
+
outputs=[nps_img_output, trust_r2_img],
|
| 2700 |
+
)
|
| 2701 |
+
|
| 2702 |
+
vw_prospects_btn.click(
|
| 2703 |
+
fn=lambda f: load_nps_and_r2(f[0]),
|
| 2704 |
+
inputs=[vw_prospects_state12],
|
| 2705 |
+
outputs=[nps_img_output, trust_r2_img],
|
| 2706 |
+
)
|
| 2707 |
+
|
| 2708 |
+
|
| 2709 |
+
demo.load(
|
| 2710 |
+
fn=lambda f: vwload_nps_and_r2(f[0]),
|
| 2711 |
+
inputs=[vw_customers_state11],
|
| 2712 |
+
outputs=[nps_img_output, trust_r2_img],
|
| 2713 |
+
)
|
| 2714 |
+
demo.load(
|
| 2715 |
+
fn=display_trust_score_1,
|
| 2716 |
+
inputs=[],
|
| 2717 |
+
outputs=trust_score_output
|
| 2718 |
+
)
|
| 2719 |
+
|
| 2720 |
+
demo.load(
|
| 2721 |
+
fn=process_examples,
|
| 2722 |
+
inputs=[vw_customers_state],
|
| 2723 |
+
outputs=outputs
|
| 2724 |
+
)
|
| 2725 |
+
|
| 2726 |
try:
|
| 2727 |
+
demo.launch(server_name="0.0.0.0")
|
| 2728 |
except Exception as e:
|
| 2729 |
+
logger.error(f"Error launching Gradio app: {e}")
|
| 2730 |
+
raise e
|