Spaces:
Sleeping
Sleeping
I have updated the UI which can help in
#1
by mahsen1302 - opened
app.py
CHANGED
|
@@ -446,14 +446,12 @@ def process_audio_input(audio, language, enable_tts):
|
|
| 446 |
custom_css = """
|
| 447 |
/* Import Google Fonts */
|
| 448 |
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
|
| 449 |
-
|
| 450 |
/* Global styles */
|
| 451 |
.gradio-container {
|
| 452 |
font-family: 'Poppins', sans-serif !important;
|
| 453 |
background: white !important;
|
| 454 |
min-height: 100vh;
|
| 455 |
}
|
| 456 |
-
|
| 457 |
/* Main container styling */
|
| 458 |
.main-container {
|
| 459 |
background: rgba(255, 255, 255, 0.95) !important;
|
|
@@ -463,7 +461,6 @@ custom_css = """
|
|
| 463 |
margin: 20px !important;
|
| 464 |
padding: 30px !important;
|
| 465 |
}
|
| 466 |
-
|
| 467 |
/* Header styling */
|
| 468 |
.header-title {
|
| 469 |
text-align: center !important;
|
|
@@ -476,7 +473,6 @@ custom_css = """
|
|
| 476 |
margin-bottom: 20px !important;
|
| 477 |
text-shadow: 2px 2px 4px rgba(0,0,0,0.1) !important;
|
| 478 |
}
|
| 479 |
-
|
| 480 |
.subtitle {
|
| 481 |
text-align: center !important;
|
| 482 |
color: #555 !important;
|
|
@@ -484,24 +480,69 @@ custom_css = """
|
|
| 484 |
margin-bottom: 30px !important;
|
| 485 |
line-height: 1.6 !important;
|
| 486 |
}
|
| 487 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 488 |
/* Feature list styling */
|
| 489 |
.features-container {
|
| 490 |
-
background: linear-gradient(
|
| 491 |
border-radius: 15px !important;
|
| 492 |
padding: 20px !important;
|
| 493 |
margin: 20px 0 !important;
|
| 494 |
color: white !important;
|
| 495 |
text-align: center !important;
|
| 496 |
}
|
| 497 |
-
|
| 498 |
.features-title {
|
| 499 |
font-size: 1.5rem !important;
|
| 500 |
font-weight: 600 !important;
|
| 501 |
margin-bottom: 15px !important;
|
| 502 |
color: white !important;
|
| 503 |
}
|
| 504 |
-
|
| 505 |
.feature-item {
|
| 506 |
display: inline-block !important;
|
| 507 |
margin: 5px 15px !important;
|
|
@@ -511,29 +552,136 @@ custom_css = """
|
|
| 511 |
backdrop-filter: blur(5px) !important;
|
| 512 |
font-weight: 500 !important;
|
| 513 |
}
|
| 514 |
-
|
| 515 |
-
/* Control panel styling */
|
| 516 |
.control-panel {
|
| 517 |
-
background:
|
| 518 |
-
border-radius:
|
| 519 |
-
padding:
|
| 520 |
margin: 20px 0 !important;
|
| 521 |
-
box-shadow: 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 522 |
}
|
| 523 |
-
|
| 524 |
-
/* Question prompt styling */
|
| 525 |
.question-prompt {
|
| 526 |
-
|
| 527 |
-
font-size: 1.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 528 |
font-weight: 600 !important;
|
| 529 |
-
color: #333 !important;
|
| 530 |
-
margin: 30px 0 20px 0 !important;
|
| 531 |
-
background: linear-gradient(135deg, #ff9a9e 0%, #fecfef 50%, #fecfef 100%) !important;
|
| 532 |
-
padding: 20px !important;
|
| 533 |
-
border-radius: 15px !important;
|
| 534 |
-
box-shadow: 0 8px 25px rgba(0, 0, 0, 0.1) !important;
|
| 535 |
}
|
| 536 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 537 |
/* Tab styling */
|
| 538 |
.tab-nav button {
|
| 539 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
|
@@ -545,16 +693,13 @@ custom_css = """
|
|
| 545 |
margin-right: 5px !important;
|
| 546 |
transition: all 0.3s ease !important;
|
| 547 |
}
|
| 548 |
-
|
| 549 |
.tab-nav button:hover {
|
| 550 |
transform: translateY(-2px) !important;
|
| 551 |
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
|
| 552 |
}
|
| 553 |
-
|
| 554 |
.tab-nav button.selected {
|
| 555 |
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
|
| 556 |
}
|
| 557 |
-
|
| 558 |
/* Input styling */
|
| 559 |
.gr-textbox, .gr-dropdown {
|
| 560 |
border: 2px solid #e1e8ed !important;
|
|
@@ -564,13 +709,11 @@ custom_css = """
|
|
| 564 |
transition: all 0.3s ease !important;
|
| 565 |
background: rgba(255, 255, 255, 0.9) !important;
|
| 566 |
}
|
| 567 |
-
|
| 568 |
.gr-textbox:focus, .gr-dropdown:focus {
|
| 569 |
border-color: #667eea !important;
|
| 570 |
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
|
| 571 |
transform: translateY(-2px) !important;
|
| 572 |
}
|
| 573 |
-
|
| 574 |
/* Button styling */
|
| 575 |
.gr-button {
|
| 576 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
|
@@ -583,12 +726,10 @@ custom_css = """
|
|
| 583 |
transition: all 0.3s ease !important;
|
| 584 |
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
|
| 585 |
}
|
| 586 |
-
|
| 587 |
.gr-button:hover {
|
| 588 |
transform: translateY(-3px) !important;
|
| 589 |
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important;
|
| 590 |
}
|
| 591 |
-
|
| 592 |
/* Output textbox styling */
|
| 593 |
.output-textbox {
|
| 594 |
border: 2px solid #e1e8ed !important;
|
|
@@ -599,45 +740,156 @@ custom_css = """
|
|
| 599 |
line-height: 1.6 !important;
|
| 600 |
padding: 20px !important;
|
| 601 |
}
|
| 602 |
-
|
| 603 |
/* Audio component styling */
|
| 604 |
.gr-audio {
|
| 605 |
border-radius: 12px !important;
|
| 606 |
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
|
| 607 |
}
|
| 608 |
-
|
| 609 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 610 |
.examples-container {
|
| 611 |
-
background: linear-gradient(
|
| 612 |
-
border-radius:
|
| 613 |
-
padding: 25px
|
| 614 |
-
margin:
|
| 615 |
-
text-align: center !important;
|
| 616 |
}
|
| 617 |
-
|
| 618 |
-
|
| 619 |
-
|
| 620 |
-
|
| 621 |
-
|
| 622 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 623 |
}
|
| 624 |
-
|
| 625 |
.example-question {
|
| 626 |
-
background:
|
| 627 |
-
|
| 628 |
-
|
| 629 |
-
|
| 630 |
-
|
| 631 |
-
|
| 632 |
-
|
| 633 |
-
|
| 634 |
-
transition: transform 0.2s ease !important;
|
| 635 |
}
|
| 636 |
-
|
| 637 |
.example-question:hover {
|
| 638 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 639 |
}
|
| 640 |
-
|
| 641 |
/* Responsive design */
|
| 642 |
@media (max-width: 768px) {
|
| 643 |
.header-title {
|
|
@@ -653,13 +905,11 @@ custom_css = """
|
|
| 653 |
margin: 5px 0 !important;
|
| 654 |
}
|
| 655 |
}
|
| 656 |
-
|
| 657 |
/* Animation keyframes */
|
| 658 |
@keyframes fadeIn {
|
| 659 |
from { opacity: 0; transform: translateY(20px); }
|
| 660 |
to { opacity: 1; transform: translateY(0); }
|
| 661 |
}
|
| 662 |
-
|
| 663 |
.gradio-container > div {
|
| 664 |
animation: fadeIn 0.6s ease-out !important;
|
| 665 |
}
|
|
@@ -675,12 +925,17 @@ def create_interface():
|
|
| 675 |
with gr.Row():
|
| 676 |
with gr.Column():
|
| 677 |
gr.HTML("""
|
| 678 |
-
<div class="header-
|
| 679 |
-
|
| 680 |
-
|
| 681 |
-
|
| 682 |
-
|
| 683 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 684 |
</div>
|
| 685 |
""")
|
| 686 |
|
|
@@ -689,79 +944,106 @@ def create_interface():
|
|
| 689 |
with gr.Column():
|
| 690 |
gr.HTML("""
|
| 691 |
<div class="features-container">
|
| 692 |
-
<div class="features-title">β¨ Features</div>
|
| 693 |
-
<div>
|
| 694 |
-
<
|
| 695 |
-
|
| 696 |
-
|
| 697 |
-
<
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 698 |
</div>
|
| 699 |
</div>
|
| 700 |
""")
|
| 701 |
|
| 702 |
# Control Panel
|
| 703 |
-
with gr.Row():
|
| 704 |
-
|
|
|
|
|
|
|
| 705 |
language_dropdown = gr.Dropdown(
|
| 706 |
choices=list(bot.languages.keys()),
|
| 707 |
value="English",
|
| 708 |
-
label="
|
| 709 |
-
|
| 710 |
-
elem_classes="gr-dropdown"
|
| 711 |
)
|
| 712 |
-
|
|
|
|
|
|
|
|
|
|
| 713 |
enable_tts_checkbox = gr.Checkbox(
|
| 714 |
value=True,
|
| 715 |
-
label="
|
| 716 |
-
|
| 717 |
-
|
| 718 |
)
|
|
|
|
|
|
|
| 719 |
|
| 720 |
-
# Question Prompt
|
| 721 |
with gr.Row():
|
| 722 |
with gr.Column():
|
| 723 |
gr.HTML("""
|
| 724 |
-
<div class="question-prompt">
|
| 725 |
-
|
|
|
|
|
|
|
| 726 |
</div>
|
| 727 |
""")
|
| 728 |
|
| 729 |
# Input Tabs
|
| 730 |
-
with gr.Tabs():
|
| 731 |
with gr.TabItem("π¬ Text Input", elem_classes="tab-item"):
|
| 732 |
with gr.Row():
|
| 733 |
with gr.Column(scale=1):
|
| 734 |
-
|
| 735 |
-
|
| 736 |
-
|
| 737 |
-
|
| 738 |
-
|
| 739 |
-
|
| 740 |
-
|
| 741 |
-
|
| 742 |
-
|
|
|
|
| 743 |
with gr.Row():
|
| 744 |
with gr.Column(scale=1):
|
| 745 |
-
|
| 746 |
-
|
| 747 |
-
|
| 748 |
-
|
| 749 |
-
|
| 750 |
-
|
| 751 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 752 |
|
| 753 |
# Output Section
|
| 754 |
-
with gr.Row():
|
| 755 |
with gr.Column():
|
| 756 |
gr.HTML("""
|
| 757 |
-
<div
|
| 758 |
π Your Travel Guide Response
|
| 759 |
</div>
|
| 760 |
""")
|
| 761 |
-
|
| 762 |
-
|
| 763 |
-
with gr.Column():
|
| 764 |
-
# Text outputs
|
| 765 |
text_output = gr.Textbox(
|
| 766 |
label="π‘ Travel Advice & Information",
|
| 767 |
lines=12,
|
|
@@ -770,47 +1052,41 @@ def create_interface():
|
|
| 770 |
elem_classes="output-textbox"
|
| 771 |
)
|
| 772 |
|
| 773 |
-
|
| 774 |
-
|
| 775 |
-
lines=12,
|
| 776 |
-
max_lines=20,
|
| 777 |
-
show_copy_button=True,
|
| 778 |
-
elem_classes="output-textbox",
|
| 779 |
-
visible=False
|
| 780 |
-
)
|
| 781 |
-
|
| 782 |
-
# Audio output section
|
| 783 |
-
with gr.Row():
|
| 784 |
-
with gr.Column(scale=1):
|
| 785 |
-
text_audio_output = gr.Audio(
|
| 786 |
-
label="π Audio Response",
|
| 787 |
-
elem_classes="gr-audio"
|
| 788 |
-
)
|
| 789 |
-
with gr.Column(scale=1):
|
| 790 |
-
audio_audio_output = gr.Audio(
|
| 791 |
label="π Audio Response",
|
| 792 |
elem_classes="gr-audio",
|
| 793 |
visible=False
|
| 794 |
)
|
| 795 |
|
| 796 |
-
#
|
| 797 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 798 |
with gr.Column():
|
| 799 |
gr.HTML("""
|
| 800 |
-
<div class="examples-
|
| 801 |
-
<
|
| 802 |
-
<
|
| 803 |
-
|
| 804 |
-
|
| 805 |
-
|
| 806 |
-
|
| 807 |
-
|
| 808 |
-
|
| 809 |
-
|
| 810 |
-
</div>
|
|
|
|
| 811 |
</div>
|
| 812 |
""")
|
| 813 |
|
|
|
|
|
|
|
| 814 |
# Event handlers for text input
|
| 815 |
def handle_text_input(question, language, enable_tts):
|
| 816 |
"""Handle text input and show/hide appropriate outputs."""
|
|
@@ -830,22 +1106,22 @@ def create_interface():
|
|
| 830 |
|
| 831 |
# Connect event handlers
|
| 832 |
text_submit_btn.click(
|
| 833 |
-
fn=
|
| 834 |
inputs=[text_input, language_dropdown, enable_tts_checkbox],
|
| 835 |
-
outputs=[text_output,
|
| 836 |
)
|
| 837 |
|
| 838 |
audio_submit_btn.click(
|
| 839 |
-
fn=
|
| 840 |
inputs=[audio_input, language_dropdown, enable_tts_checkbox],
|
| 841 |
-
outputs=[
|
| 842 |
)
|
| 843 |
|
| 844 |
# Auto-submit on Enter for text input
|
| 845 |
text_input.submit(
|
| 846 |
fn=handle_text_input,
|
| 847 |
inputs=[text_input, language_dropdown, enable_tts_checkbox],
|
| 848 |
-
outputs=[text_output,
|
| 849 |
)
|
| 850 |
|
| 851 |
# Example question click handlers
|
|
|
|
| 446 |
custom_css = """
|
| 447 |
/* Import Google Fonts */
|
| 448 |
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@300;400;500;600;700&display=swap');
|
|
|
|
| 449 |
/* Global styles */
|
| 450 |
.gradio-container {
|
| 451 |
font-family: 'Poppins', sans-serif !important;
|
| 452 |
background: white !important;
|
| 453 |
min-height: 100vh;
|
| 454 |
}
|
|
|
|
| 455 |
/* Main container styling */
|
| 456 |
.main-container {
|
| 457 |
background: rgba(255, 255, 255, 0.95) !important;
|
|
|
|
| 461 |
margin: 20px !important;
|
| 462 |
padding: 30px !important;
|
| 463 |
}
|
|
|
|
| 464 |
/* Header styling */
|
| 465 |
.header-title {
|
| 466 |
text-align: center !important;
|
|
|
|
| 473 |
margin-bottom: 20px !important;
|
| 474 |
text-shadow: 2px 2px 4px rgba(0,0,0,0.1) !important;
|
| 475 |
}
|
|
|
|
| 476 |
.subtitle {
|
| 477 |
text-align: center !important;
|
| 478 |
color: #555 !important;
|
|
|
|
| 480 |
margin-bottom: 30px !important;
|
| 481 |
line-height: 1.6 !important;
|
| 482 |
}
|
| 483 |
+
/* Features Section - Modern Card Design */
|
| 484 |
+
.features-container {
|
| 485 |
+
background: white !important;
|
| 486 |
+
border-radius: 16px !important;
|
| 487 |
+
padding: 25px !important;
|
| 488 |
+
margin: 20px 0 !important;
|
| 489 |
+
box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
|
| 490 |
+
border: 1px solid #f0f0f0 !important;
|
| 491 |
+
}
|
| 492 |
+
.features-title {
|
| 493 |
+
font-size: 1.4rem !important;
|
| 494 |
+
font-weight: 600 !important;
|
| 495 |
+
margin-bottom: 20px !important;
|
| 496 |
+
color: #333 !important;
|
| 497 |
+
text-align: center !important;
|
| 498 |
+
}
|
| 499 |
+
.features-grid {
|
| 500 |
+
display: grid !important;
|
| 501 |
+
grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)) !important;
|
| 502 |
+
gap: 15px !important;
|
| 503 |
+
}
|
| 504 |
+
.feature-card {
|
| 505 |
+
background: #f9f9f9 !important;
|
| 506 |
+
border-radius: 12px !important;
|
| 507 |
+
padding: 20px 15px !important;
|
| 508 |
+
text-align: center !important;
|
| 509 |
+
transition: all 0.3s ease !important;
|
| 510 |
+
border: 1px solid #eee !important;
|
| 511 |
+
}
|
| 512 |
+
.feature-card:hover {
|
| 513 |
+
transform: translateY(-5px) !important;
|
| 514 |
+
box-shadow: 0 6px 15px rgba(0,0,0,0.1) !important;
|
| 515 |
+
background: #f5f5f5 !important;
|
| 516 |
+
}
|
| 517 |
+
.feature-icon {
|
| 518 |
+
font-size: 2rem !important;
|
| 519 |
+
margin-bottom: 10px !important;
|
| 520 |
+
}
|
| 521 |
+
.feature-text {
|
| 522 |
+
font-weight: 500 !important;
|
| 523 |
+
color: #555 !important;
|
| 524 |
+
font-size: 0.95rem !important;
|
| 525 |
+
}
|
| 526 |
+
/* Option 1: Light blue accent */
|
| 527 |
+
.feature-card {
|
| 528 |
+
background: #f8fafc !important;
|
| 529 |
+
border: 1px solid #e0e7ff !important;
|
| 530 |
+
}
|
| 531 |
/* Feature list styling */
|
| 532 |
.features-container {
|
| 533 |
+
background: linear-gradient(145deg, #2c3e50 0%, #1e272e 100%) !important;
|
| 534 |
border-radius: 15px !important;
|
| 535 |
padding: 20px !important;
|
| 536 |
margin: 20px 0 !important;
|
| 537 |
color: white !important;
|
| 538 |
text-align: center !important;
|
| 539 |
}
|
|
|
|
| 540 |
.features-title {
|
| 541 |
font-size: 1.5rem !important;
|
| 542 |
font-weight: 600 !important;
|
| 543 |
margin-bottom: 15px !important;
|
| 544 |
color: white !important;
|
| 545 |
}
|
|
|
|
| 546 |
.feature-item {
|
| 547 |
display: inline-block !important;
|
| 548 |
margin: 5px 15px !important;
|
|
|
|
| 552 |
backdrop-filter: blur(5px) !important;
|
| 553 |
font-weight: 500 !important;
|
| 554 |
}
|
| 555 |
+
/* Modern Control Panel - Fixed Checkbox Version */
|
|
|
|
| 556 |
.control-panel {
|
| 557 |
+
background: white !important;
|
| 558 |
+
border-radius: 16px !important;
|
| 559 |
+
padding: 20px !important;
|
| 560 |
margin: 20px 0 !important;
|
| 561 |
+
box-shadow: 0 4px 20px rgba(0,0,0,0.08) !important;
|
| 562 |
+
gap: 20px !important;
|
| 563 |
+
}
|
| 564 |
+
.control-section {
|
| 565 |
+
padding: 20px !important;
|
| 566 |
+
border-radius: 12px !important;
|
| 567 |
+
}
|
| 568 |
+
.language-section {
|
| 569 |
+
background: linear-gradient(145deg, #2c3e50 0%, #1e272e 100%) !important;
|
| 570 |
+
}
|
| 571 |
+
.voice-section {
|
| 572 |
+
background: linear-gradient(145deg, #2c3e50 0%, #1e272e 100%) !important;
|
| 573 |
+
display: flex !important;
|
| 574 |
+
flex-direction: column !important;
|
| 575 |
+
}
|
| 576 |
+
.section-header {
|
| 577 |
+
color: white !important;
|
| 578 |
+
margin-bottom: 15px !important;
|
| 579 |
+
font-size: 1rem !important;
|
| 580 |
+
font-weight: 600 !important;
|
| 581 |
+
}
|
| 582 |
+
/* Fixed Checkbox Styling */
|
| 583 |
+
.dark-checkbox {
|
| 584 |
+
--size: 18px;
|
| 585 |
+
margin: 0 !important;
|
| 586 |
+
align-items: center !important;
|
| 587 |
+
}
|
| 588 |
+
.dark-checkbox .wrap {
|
| 589 |
+
display: flex !important;
|
| 590 |
+
align-items: center !important;
|
| 591 |
+
gap: 12px !important;
|
| 592 |
+
color: white !important;
|
| 593 |
+
}
|
| 594 |
+
.dark-checkbox input[type="checkbox"] {
|
| 595 |
+
width: var(--size) !important;
|
| 596 |
+
height: var(--size) !important;
|
| 597 |
+
min-width: var(--size) !important;
|
| 598 |
+
min-height: var(--size) !important;
|
| 599 |
+
}
|
| 600 |
+
.dark-checkbox label {
|
| 601 |
+
color: white !important;
|
| 602 |
+
font-size: 0.95rem !important;
|
| 603 |
+
margin: 0 !important;
|
| 604 |
+
padding: 0 !important;
|
| 605 |
+
}
|
| 606 |
+
/* Question Prompt Container */
|
| 607 |
+
.question-prompt-container {
|
| 608 |
+
background: linear-gradient(145deg, #2c3e50 0%, #1e272e 100%);
|
| 609 |
+
border-radius: 16px;
|
| 610 |
+
padding: 25px;
|
| 611 |
+
margin-bottom: 20px;
|
| 612 |
+
text-align: center;
|
| 613 |
}
|
|
|
|
|
|
|
| 614 |
.question-prompt {
|
| 615 |
+
color: white;
|
| 616 |
+
font-size: 1.5rem;
|
| 617 |
+
font-weight: 600;
|
| 618 |
+
margin: 0;
|
| 619 |
+
}
|
| 620 |
+
/* Custom Tabs */
|
| 621 |
+
.custom-tabs {
|
| 622 |
+
background: linear-gradient(145deg, #2c3e50 0%, #1e272e 100%);
|
| 623 |
+
border-radius: 16px;
|
| 624 |
+
padding: 20px;
|
| 625 |
+
margin-bottom: 20px;
|
| 626 |
+
}
|
| 627 |
+
.custom-tabs .tab-nav {
|
| 628 |
+
margin-bottom: 20px;
|
| 629 |
+
}
|
| 630 |
+
.custom-tabs .tab-nav button {
|
| 631 |
+
color: white !important;
|
| 632 |
+
background: rgba(255,255,255,0.1) !important;
|
| 633 |
+
border: none !important;
|
| 634 |
+
border-radius: 8px !important;
|
| 635 |
+
margin-right: 10px !important;
|
| 636 |
+
padding: 10px 20px !important;
|
| 637 |
+
transition: all 0.3s ease !important;
|
| 638 |
+
}
|
| 639 |
+
.custom-tabs .tab-nav button.selected {
|
| 640 |
+
background: rgba(255,255,255,0.2) !important;
|
| 641 |
font-weight: 600 !important;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 642 |
}
|
| 643 |
+
/* Question Input Group */
|
| 644 |
+
.question-group {
|
| 645 |
+
background: #1a202c;
|
| 646 |
+
border-radius: 12px;
|
| 647 |
+
padding: 15px;
|
| 648 |
+
margin-bottom: 15px;
|
| 649 |
+
}
|
| 650 |
+
.question-label {
|
| 651 |
+
color: white !important;
|
| 652 |
+
font-size: 1.1rem !important;
|
| 653 |
+
margin-bottom: 10px !important;
|
| 654 |
+
}
|
| 655 |
+
.question-textbox {
|
| 656 |
+
background: #2d3748 !important;
|
| 657 |
+
color: white !important;
|
| 658 |
+
border: 1px solid #4a5568 !important;
|
| 659 |
+
border-radius: 10px !important;
|
| 660 |
+
padding: 15px !important;
|
| 661 |
+
}
|
| 662 |
+
.question-textbox::placeholder {
|
| 663 |
+
color: #a0aec0 !important;
|
| 664 |
+
}
|
| 665 |
+
.question-audio {
|
| 666 |
+
width: 100% !important;
|
| 667 |
+
border-radius: 10px !important;
|
| 668 |
+
}
|
| 669 |
+
/* Modern Button */
|
| 670 |
+
.modern-btn {
|
| 671 |
+
background: white !important;
|
| 672 |
+
color: #2d3748 !important;
|
| 673 |
+
border: none !important;
|
| 674 |
+
border-radius: 50px !important;
|
| 675 |
+
padding: 12px 30px !important;
|
| 676 |
+
font-weight: 600 !important;
|
| 677 |
+
font-size: 1rem !important;
|
| 678 |
+
transition: all 0.3s ease !important;
|
| 679 |
+
box-shadow: 0 4px 15px rgba(0,0,0,0.1) !important;
|
| 680 |
+
}
|
| 681 |
+
.modern-btn:hover {
|
| 682 |
+
transform: translateY(-2px) !important;
|
| 683 |
+
box-shadow: 0 6px 20px rgba(0,0,0,0.15) !important;
|
| 684 |
+
}
|
| 685 |
/* Tab styling */
|
| 686 |
.tab-nav button {
|
| 687 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
|
|
|
| 693 |
margin-right: 5px !important;
|
| 694 |
transition: all 0.3s ease !important;
|
| 695 |
}
|
|
|
|
| 696 |
.tab-nav button:hover {
|
| 697 |
transform: translateY(-2px) !important;
|
| 698 |
box-shadow: 0 5px 15px rgba(0, 0, 0, 0.2) !important;
|
| 699 |
}
|
|
|
|
| 700 |
.tab-nav button.selected {
|
| 701 |
background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%) !important;
|
| 702 |
}
|
|
|
|
| 703 |
/* Input styling */
|
| 704 |
.gr-textbox, .gr-dropdown {
|
| 705 |
border: 2px solid #e1e8ed !important;
|
|
|
|
| 709 |
transition: all 0.3s ease !important;
|
| 710 |
background: rgba(255, 255, 255, 0.9) !important;
|
| 711 |
}
|
|
|
|
| 712 |
.gr-textbox:focus, .gr-dropdown:focus {
|
| 713 |
border-color: #667eea !important;
|
| 714 |
box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1) !important;
|
| 715 |
transform: translateY(-2px) !important;
|
| 716 |
}
|
|
|
|
| 717 |
/* Button styling */
|
| 718 |
.gr-button {
|
| 719 |
background: linear-gradient(135deg, #667eea 0%, #764ba2 100%) !important;
|
|
|
|
| 726 |
transition: all 0.3s ease !important;
|
| 727 |
box-shadow: 0 4px 15px rgba(102, 126, 234, 0.4) !important;
|
| 728 |
}
|
|
|
|
| 729 |
.gr-button:hover {
|
| 730 |
transform: translateY(-3px) !important;
|
| 731 |
box-shadow: 0 6px 20px rgba(102, 126, 234, 0.6) !important;
|
| 732 |
}
|
|
|
|
| 733 |
/* Output textbox styling */
|
| 734 |
.output-textbox {
|
| 735 |
border: 2px solid #e1e8ed !important;
|
|
|
|
| 740 |
line-height: 1.6 !important;
|
| 741 |
padding: 20px !important;
|
| 742 |
}
|
|
|
|
| 743 |
/* Audio component styling */
|
| 744 |
.gr-audio {
|
| 745 |
border-radius: 12px !important;
|
| 746 |
box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1) !important;
|
| 747 |
}
|
| 748 |
+
/* Output Section */
|
| 749 |
+
.output-section {
|
| 750 |
+
background: white;
|
| 751 |
+
border-radius: 16px;
|
| 752 |
+
padding: 25px;
|
| 753 |
+
margin: 20px 0;
|
| 754 |
+
box-shadow: 0 4px 20px rgba(0,0,0,0.08);
|
| 755 |
+
}
|
| 756 |
+
.output-header {
|
| 757 |
+
text-align: center;
|
| 758 |
+
font-size: 1.5rem;
|
| 759 |
+
font-weight: 600;
|
| 760 |
+
color: #2d3748;
|
| 761 |
+
margin-bottom: 20px;
|
| 762 |
+
}
|
| 763 |
+
.output-textbox {
|
| 764 |
+
border: 2px solid #e2e8f0 !important;
|
| 765 |
+
border-radius: 12px !important;
|
| 766 |
+
background: white !important;
|
| 767 |
+
padding: 20px !important;
|
| 768 |
+
font-size: 1rem !important;
|
| 769 |
+
line-height: 1.6 !important;
|
| 770 |
+
box-shadow: 0 2px 10px rgba(0,0,0,0.05) !important;
|
| 771 |
+
}
|
| 772 |
+
.gr-audio {
|
| 773 |
+
border-radius: 12px !important;
|
| 774 |
+
background: white !important;
|
| 775 |
+
border: 2px solid #e2e8f0 !important;
|
| 776 |
+
padding: 15px !important;
|
| 777 |
+
box-shadow: 0 2px 10px rgba(0,0,0,0.05) !important;
|
| 778 |
+
margin-top: 15px !important;
|
| 779 |
+
}
|
| 780 |
+
/* EXAMPLES SECTION STYLING */
|
| 781 |
.examples-container {
|
| 782 |
+
background: linear-gradient(145deg, #2c3e50 0%, #1e272e 100%);
|
| 783 |
+
border-radius: 16px;
|
| 784 |
+
padding: 25px;
|
| 785 |
+
margin: 20px 0;
|
|
|
|
| 786 |
}
|
| 787 |
+
.examples-header {
|
| 788 |
+
display: flex;
|
| 789 |
+
align-items: center;
|
| 790 |
+
gap: 10px;
|
| 791 |
+
margin-bottom: 20px;
|
| 792 |
+
color: white;
|
| 793 |
+
justify-content: center;
|
| 794 |
+
}
|
| 795 |
+
.examples-header h3 {
|
| 796 |
+
margin: 0;
|
| 797 |
+
font-size: 1.3rem;
|
| 798 |
+
}
|
| 799 |
+
.examples-icon {
|
| 800 |
+
font-size: 1.5rem;
|
| 801 |
+
}
|
| 802 |
+
.examples-grid {
|
| 803 |
+
display: grid;
|
| 804 |
+
grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
|
| 805 |
+
gap: 12px;
|
| 806 |
}
|
|
|
|
| 807 |
.example-question {
|
| 808 |
+
background: white;
|
| 809 |
+
color: black;
|
| 810 |
+
border-radius: 10px;
|
| 811 |
+
padding: 12px 15px;
|
| 812 |
+
cursor: pointer;
|
| 813 |
+
transition: all 0.3s ease;
|
| 814 |
+
border: 1px solid rgba(255,255,255,0.2);
|
| 815 |
+
text-align: center;
|
|
|
|
| 816 |
}
|
|
|
|
| 817 |
.example-question:hover {
|
| 818 |
+
background: rgba(255,255,255,0.2);
|
| 819 |
+
transform: translateY(-3px);
|
| 820 |
+
box-shadow: 0 4px 12px rgba(0,0,0,0.1);
|
| 821 |
+
}
|
| 822 |
+
/* Modern Header Styles */
|
| 823 |
+
.header-container {
|
| 824 |
+
text-align: center;
|
| 825 |
+
padding: 30px 20px;
|
| 826 |
+
margin-bottom: 20px;
|
| 827 |
+
background: white;
|
| 828 |
+
border-radius: 16px;
|
| 829 |
+
box-shadow: 0 4px 30px rgba(0,0,0,0.08);
|
| 830 |
+
}
|
| 831 |
+
.header-title {
|
| 832 |
+
font-size: 3.5rem;
|
| 833 |
+
font-weight: 800;
|
| 834 |
+
background: linear-gradient(145deg, #2c3e50 0%, #1e272e 100%);
|
| 835 |
+
-webkit-background-clip: text;
|
| 836 |
+
background-clip: text;
|
| 837 |
+
color: transparent;
|
| 838 |
+
margin-bottom: 15px;
|
| 839 |
+
letter-spacing: -1px;
|
| 840 |
+
}
|
| 841 |
+
.title-accent {
|
| 842 |
+
color: #000000; /* Pure black */
|
| 843 |
+
font-weight: 800;
|
| 844 |
+
text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
|
| 845 |
+
}
|
| 846 |
+
.title-accent {
|
| 847 |
+
color: #2d3748; /* Pure black */
|
| 848 |
+
font-weight: 800;
|
| 849 |
+
text-shadow: 1px 1px 3px rgba(0,0,0,0.2);
|
| 850 |
+
}
|
| 851 |
+
.title-accent {
|
| 852 |
+
color: linear-gradient(145deg, #2c3e50 0%, #1e272e 100%); /* Matches your features section */
|
| 853 |
+
}
|
| 854 |
+
.header-subtitle {
|
| 855 |
+
font-size: 1.5rem;
|
| 856 |
+
color: #7f8c8d;
|
| 857 |
+
margin-bottom: 15px;
|
| 858 |
+
font-weight: 500;
|
| 859 |
+
}
|
| 860 |
+
.highlight {
|
| 861 |
+
background: linear-gradient(145deg, #2c3e50 0%, #1e272e 100%) !important;
|
| 862 |
+
background-repeat: no-repeat;
|
| 863 |
+
background-size: 100% 30%;
|
| 864 |
+
background-position: 0 85%;
|
| 865 |
+
padding: 0 4px;
|
| 866 |
+
}
|
| 867 |
+
.header-divider {
|
| 868 |
+
width: 100px;
|
| 869 |
+
height: 4px;
|
| 870 |
+
background: linear-gradient(to right, #3498db, #2ecc71);
|
| 871 |
+
margin: 0 auto 20px;
|
| 872 |
+
border-radius: 2px;
|
| 873 |
+
}
|
| 874 |
+
.header-tagline {
|
| 875 |
+
display: flex;
|
| 876 |
+
justify-content: center;
|
| 877 |
+
gap: 15px;
|
| 878 |
+
flex-wrap: wrap;
|
| 879 |
+
color: #2c3e50;
|
| 880 |
+
font-weight: 500;
|
| 881 |
+
font-size: 1.1rem;
|
| 882 |
+
}
|
| 883 |
+
.header-tagline span {
|
| 884 |
+
display: inline-flex;
|
| 885 |
+
align-items: center;
|
| 886 |
+
gap: 5px;
|
| 887 |
+
}
|
| 888 |
+
/* Emoji styling */
|
| 889 |
+
.emoji {
|
| 890 |
+
font-size: 1.2em;
|
| 891 |
+
vertical-align: middle;
|
| 892 |
}
|
|
|
|
| 893 |
/* Responsive design */
|
| 894 |
@media (max-width: 768px) {
|
| 895 |
.header-title {
|
|
|
|
| 905 |
margin: 5px 0 !important;
|
| 906 |
}
|
| 907 |
}
|
|
|
|
| 908 |
/* Animation keyframes */
|
| 909 |
@keyframes fadeIn {
|
| 910 |
from { opacity: 0; transform: translateY(20px); }
|
| 911 |
to { opacity: 1; transform: translateY(0); }
|
| 912 |
}
|
|
|
|
| 913 |
.gradio-container > div {
|
| 914 |
animation: fadeIn 0.6s ease-out !important;
|
| 915 |
}
|
|
|
|
| 925 |
with gr.Row():
|
| 926 |
with gr.Column():
|
| 927 |
gr.HTML("""
|
| 928 |
+
<div class="header-container">
|
| 929 |
+
<div class="header-title">
|
| 930 |
+
βοΈ <span class="title-accent">TravelGenie</span>
|
| 931 |
+
</div>
|
| 932 |
+
<div class="header-subtitle">
|
| 933 |
+
Your <span class="highlight">AI-Powered</span> Travel Companion
|
| 934 |
+
</div>
|
| 935 |
+
<div class="header-divider"></div>
|
| 936 |
+
<div class="header-tagline">
|
| 937 |
+
Discover destinations β’ Get instant advice β’ Traveling tips
|
| 938 |
+
</div>
|
| 939 |
</div>
|
| 940 |
""")
|
| 941 |
|
|
|
|
| 944 |
with gr.Column():
|
| 945 |
gr.HTML("""
|
| 946 |
<div class="features-container">
|
| 947 |
+
<div class="features-title">β¨ Key Features</div>
|
| 948 |
+
<div class="features-grid">
|
| 949 |
+
<div class="feature-card">
|
| 950 |
+
<div class="feature-icon">π£οΈ</div>
|
| 951 |
+
<div class="feature-text">Voice Input & Output</div>
|
| 952 |
+
</div>
|
| 953 |
+
<div class="feature-card">
|
| 954 |
+
<div class="feature-icon">π</div>
|
| 955 |
+
<div class="feature-text">10+ Languages</div>
|
| 956 |
+
</div>
|
| 957 |
+
<div class="feature-card">
|
| 958 |
+
<div class="feature-icon">π€</div>
|
| 959 |
+
<div class="feature-text">AI Recommendations</div>
|
| 960 |
+
</div>
|
| 961 |
+
<div class="feature-card">
|
| 962 |
+
<div class="feature-icon">β‘</div>
|
| 963 |
+
<div class="feature-text">Fast Responses</div>
|
| 964 |
+
</div>
|
| 965 |
</div>
|
| 966 |
</div>
|
| 967 |
""")
|
| 968 |
|
| 969 |
# Control Panel
|
| 970 |
+
with gr.Row(elem_classes="control-panel"):
|
| 971 |
+
# Language Section
|
| 972 |
+
with gr.Column(scale=1, min_width=300, elem_classes="control-section language-section"):
|
| 973 |
+
gr.Markdown("### π LANGUAGE", elem_classes="section-header")
|
| 974 |
language_dropdown = gr.Dropdown(
|
| 975 |
choices=list(bot.languages.keys()),
|
| 976 |
value="English",
|
| 977 |
+
label="Select your preferred language",
|
| 978 |
+
elem_classes="dark-dropdown"
|
|
|
|
| 979 |
)
|
| 980 |
+
|
| 981 |
+
# Voice Section (Fixed)
|
| 982 |
+
with gr.Column(scale=1, min_width=300, elem_classes="control-section voice-section"):
|
| 983 |
+
gr.Markdown("### π VOICE", elem_classes="section-header")
|
| 984 |
enable_tts_checkbox = gr.Checkbox(
|
| 985 |
value=True,
|
| 986 |
+
label="Enable voice responses",
|
| 987 |
+
elem_classes="dark-checkbox",
|
| 988 |
+
interactive=True
|
| 989 |
)
|
| 990 |
+
|
| 991 |
+
|
| 992 |
|
| 993 |
+
# Question Prompt Section
|
| 994 |
with gr.Row():
|
| 995 |
with gr.Column():
|
| 996 |
gr.HTML("""
|
| 997 |
+
<div class="question-prompt-container">
|
| 998 |
+
<div class="question-prompt">
|
| 999 |
+
π€ Ask your travel question in text or voice
|
| 1000 |
+
</div>
|
| 1001 |
</div>
|
| 1002 |
""")
|
| 1003 |
|
| 1004 |
# Input Tabs
|
| 1005 |
+
with gr.Tabs(elem_classes="custom-tabs"):
|
| 1006 |
with gr.TabItem("π¬ Text Input", elem_classes="tab-item"):
|
| 1007 |
with gr.Row():
|
| 1008 |
with gr.Column(scale=1):
|
| 1009 |
+
with gr.Group(elem_classes="question-group"):
|
| 1010 |
+
gr.Markdown("βοΈ Your Travel Question", elem_classes="question-label")
|
| 1011 |
+
text_input = gr.Textbox(
|
| 1012 |
+
placeholder="Ask me anything about destinations, travel tips, local customs...",
|
| 1013 |
+
lines=4,
|
| 1014 |
+
elem_classes="question-textbox"
|
| 1015 |
+
)
|
| 1016 |
+
text_submit_btn = gr.Button("Get Travel Advice", elem_classes="modern-btn")
|
| 1017 |
+
|
| 1018 |
+
with gr.TabItem("π€ Voice Input", elem_classes="tab-item", visible=enable_tts_checkbox.value) as voice_tab:
|
| 1019 |
with gr.Row():
|
| 1020 |
with gr.Column(scale=1):
|
| 1021 |
+
with gr.Group(elem_classes="question-group"):
|
| 1022 |
+
gr.Markdown("π€ Record Your Travel Question", elem_classes="question-label")
|
| 1023 |
+
audio_input = gr.Audio(
|
| 1024 |
+
sources=["microphone"],
|
| 1025 |
+
type="filepath",
|
| 1026 |
+
elem_classes="question-audio"
|
| 1027 |
+
)
|
| 1028 |
+
audio_submit_btn = gr.Button("Process Voice Question", elem_classes="modern-btn")
|
| 1029 |
+
|
| 1030 |
+
# This makes voice tab visibility depend on the checkbox
|
| 1031 |
+
enable_tts_checkbox.change(
|
| 1032 |
+
lambda x: gr.update(visible=x),
|
| 1033 |
+
inputs=[enable_tts_checkbox],
|
| 1034 |
+
outputs=[voice_tab]
|
| 1035 |
+
)
|
| 1036 |
|
| 1037 |
# Output Section
|
| 1038 |
+
with gr.Row(elem_classes="output-section"):
|
| 1039 |
with gr.Column():
|
| 1040 |
gr.HTML("""
|
| 1041 |
+
<div class="output-header">
|
| 1042 |
π Your Travel Guide Response
|
| 1043 |
</div>
|
| 1044 |
""")
|
| 1045 |
+
|
| 1046 |
+
# Single text output box
|
|
|
|
|
|
|
| 1047 |
text_output = gr.Textbox(
|
| 1048 |
label="π‘ Travel Advice & Information",
|
| 1049 |
lines=12,
|
|
|
|
| 1052 |
elem_classes="output-textbox"
|
| 1053 |
)
|
| 1054 |
|
| 1055 |
+
# Audio output (conditionally visible)
|
| 1056 |
+
audio_output = gr.Audio(
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1057 |
label="π Audio Response",
|
| 1058 |
elem_classes="gr-audio",
|
| 1059 |
visible=False
|
| 1060 |
)
|
| 1061 |
|
| 1062 |
+
# Connect TTS checkbox to audio output visibility
|
| 1063 |
+
enable_tts_checkbox.change(
|
| 1064 |
+
lambda x: gr.update(visible=x),
|
| 1065 |
+
inputs=[enable_tts_checkbox],
|
| 1066 |
+
outputs=[audio_output]
|
| 1067 |
+
)
|
| 1068 |
+
|
| 1069 |
+
# ========== EXAMPLE QUESTIONS SECTION ==========
|
| 1070 |
+
with gr.Row(elem_classes="examples-container"):
|
| 1071 |
with gr.Column():
|
| 1072 |
gr.HTML("""
|
| 1073 |
+
<div class="examples-header">
|
| 1074 |
+
<span class="examples-icon">π‘</span>
|
| 1075 |
+
<h3>Try These Example Questions</h3>
|
| 1076 |
+
</div>
|
| 1077 |
+
<div class="examples-grid">
|
| 1078 |
+
<div class="example-question">"What are the best places to visit in Paris?"</div>
|
| 1079 |
+
<div class="example-question">"Give me travel tips for first-time international travelers"</div>
|
| 1080 |
+
<div class="example-question">"What's the best time to visit Japan?"</div>
|
| 1081 |
+
<div class="example-question">"How can I save money while traveling in Europe?"</div>
|
| 1082 |
+
<div class="example-question">"Tell me about local customs in Dubai"</div>
|
| 1083 |
+
<div class="example-question">"Best budget-friendly destinations in Southeast Asia"</div>
|
| 1084 |
+
<div class="example-question">"What documents do I need for international travel?"</div>
|
| 1085 |
</div>
|
| 1086 |
""")
|
| 1087 |
|
| 1088 |
+
|
| 1089 |
+
|
| 1090 |
# Event handlers for text input
|
| 1091 |
def handle_text_input(question, language, enable_tts):
|
| 1092 |
"""Handle text input and show/hide appropriate outputs."""
|
|
|
|
| 1106 |
|
| 1107 |
# Connect event handlers
|
| 1108 |
text_submit_btn.click(
|
| 1109 |
+
fn=process_text_input,
|
| 1110 |
inputs=[text_input, language_dropdown, enable_tts_checkbox],
|
| 1111 |
+
outputs=[text_output, audio_output]
|
| 1112 |
)
|
| 1113 |
|
| 1114 |
audio_submit_btn.click(
|
| 1115 |
+
fn=process_audio_input,
|
| 1116 |
inputs=[audio_input, language_dropdown, enable_tts_checkbox],
|
| 1117 |
+
outputs=[text_output, audio_output]
|
| 1118 |
)
|
| 1119 |
|
| 1120 |
# Auto-submit on Enter for text input
|
| 1121 |
text_input.submit(
|
| 1122 |
fn=handle_text_input,
|
| 1123 |
inputs=[text_input, language_dropdown, enable_tts_checkbox],
|
| 1124 |
+
outputs=[text_output, audio_output]
|
| 1125 |
)
|
| 1126 |
|
| 1127 |
# Example question click handlers
|