Spaces:
Running
Running
Update app.py
Browse files
app.py
CHANGED
@@ -593,10 +593,10 @@ def display_modern_progress(current_step, total_steps=6):
|
|
593 |
if 'progress_steps' not in st.session_state:
|
594 |
st.session_state.progress_steps = {
|
595 |
0: {'status': 'pending', 'name': t("trip_details")},
|
596 |
-
1: {'status': 'pending', 'name': t("about")},
|
597 |
-
2: {'status': 'pending', 'name': t("travel_style")},
|
598 |
-
3: {'status': 'pending', 'name': t("live_agent_outputs")},
|
599 |
-
4: {'status': 'pending', 'name': t("download_share")},
|
600 |
5: {'status': 'pending', 'name': t("full_itinerary")}
|
601 |
}
|
602 |
|
@@ -611,7 +611,7 @@ def display_modern_progress(current_step, total_steps=6):
|
|
611 |
progress_percentage = (current_step / total_steps) * 100
|
612 |
st.progress(progress_percentage / 100)
|
613 |
|
614 |
-
st.markdown(
|
615 |
<style>
|
616 |
.compact-progress {
|
617 |
background: white;
|
@@ -666,7 +666,7 @@ def display_modern_progress(current_step, total_steps=6):
|
|
666 |
}
|
667 |
</style>
|
668 |
<div class="compact-progress">
|
669 |
-
|
670 |
|
671 |
st.markdown('<div class="step-grid">', unsafe_allow_html=True)
|
672 |
for i, step_info in st.session_state.progress_steps.items():
|
@@ -682,12 +682,12 @@ def display_modern_progress(current_step, total_steps=6):
|
|
682 |
icon = "β"
|
683 |
status_class = "pending"
|
684 |
|
685 |
-
st.markdown(f
|
686 |
<div class="step-item {status_class}">
|
687 |
<span class="step-icon">{icon}</span>
|
688 |
<span class="step-text">{name}</span>
|
689 |
</div>
|
690 |
-
|
691 |
|
692 |
st.markdown('</div></div>', unsafe_allow_html=True)
|
693 |
return progress_percentage
|
@@ -720,7 +720,7 @@ def run_task_with_logs(task, input_text, log_container, output_container, result
|
|
720 |
|
721 |
with output_container:
|
722 |
st.markdown(f"### {task.agent.role} Output")
|
723 |
-
st.markdown("
|
724 |
|
725 |
return result
|
726 |
|
@@ -751,7 +751,7 @@ if 'form_submitted' not in st.session_state:
|
|
751 |
st.session_state.form_submitted = False
|
752 |
|
753 |
# Modern animated header
|
754 |
-
st.markdown(f
|
755 |
<div class="animate-in" style="text-align: center;">
|
756 |
<div style="margin-bottom: 20px;">
|
757 |
<img src="https://img.icons8.com/fluency/96/travel-card.png" width="90" style="filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));">
|
@@ -761,26 +761,26 @@ st.markdown(f'''
|
|
761 |
β¨ Create your personalized AI-powered travel itinerary in minutes! β¨
|
762 |
</p>
|
763 |
</div>
|
764 |
-
|
765 |
|
766 |
st.markdown('<hr style="height:3px;border:none;background-color:#f0f0f0;margin-bottom:25px;">', unsafe_allow_html=True)
|
767 |
|
768 |
with st.sidebar:
|
769 |
-
st.markdown(
|
770 |
<div style="text-align: center; padding: 20px 0; margin-bottom: 20px; border-bottom: 1px solid #eaeaea;">
|
771 |
<img src="https://img.icons8.com/fluency/96/travel-card.png" width="80" style="margin-bottom: 15px;">
|
772 |
<h3 style="margin-bottom: 5px; color: #4361ee;">Globetrotter AI: Your AI Agent for Travelling</h3>
|
773 |
<p style="color: #6c757d; font-size: 0.9rem;">AI-Powered Travel Planning</p>
|
774 |
</div>
|
775 |
-
|
776 |
|
777 |
st.markdown('<div class="modern-card">', unsafe_allow_html=True)
|
778 |
-
st.markdown(
|
779 |
st.info("This AI-powered tool creates a personalized travel itinerary based on your preferences. Fill in the form and let our specialized travel agents plan your perfect trip!")
|
780 |
st.markdown('</div>', unsafe_allow_html=True)
|
781 |
|
782 |
st.markdown('<div class="modern-card">', unsafe_allow_html=True)
|
783 |
-
st.markdown(
|
784 |
st.markdown("""
|
785 |
<ol style="padding-left: 25px;">
|
786 |
<li><b>ποΈ Enter</b> your travel details</li>
|
@@ -802,13 +802,13 @@ with st.sidebar:
|
|
802 |
("π
Itinerary Creator", "Puts everything together in a daily plan")
|
803 |
]
|
804 |
for name, desc in agents:
|
805 |
-
st.markdown(
|
806 |
-
st.markdown(
|
807 |
st.markdown('</div>', unsafe_allow_html=True)
|
808 |
|
809 |
if not st.session_state.generation_complete:
|
810 |
st.markdown('<div class="modern-card animate-in">', unsafe_allow_html=True)
|
811 |
-
st.markdown(
|
812 |
|
813 |
st.markdown("""
|
814 |
<p style="color: var(--text-light); margin-bottom: 16px; font-size: 14px; font-weight: 400;">Complete the form below for a personalized travel plan.</p>
|
@@ -824,7 +824,7 @@ if not st.session_state.generation_complete:
|
|
824 |
start_date = st.date_input("Start Date", min_value=datetime.now(), label_visibility="collapsed")
|
825 |
duration = st.slider(t("duration"), min_value=1, max_value=30, value=7)
|
826 |
end_date = start_date + timedelta(days=duration-1)
|
827 |
-
st.markdown(
|
828 |
with col2:
|
829 |
st.markdown('<p style="font-weight: 500; color: var(--primary); font-size: 14px; margin-bottom: 12px;">Preferences</p>', unsafe_allow_html=True)
|
830 |
travelers = st.number_input("Travelers", min_value=1, max_value=15, value=2)
|
@@ -917,15 +917,15 @@ Special Requirements: {user_input['special_requirements']}
|
|
917 |
progress_tab, logs_tab, details_tab = st.tabs(["π Progress", "π Live Activity", "π " + t("request_details")])
|
918 |
with details_tab:
|
919 |
st.markdown("#### " + t("request_details"))
|
920 |
-
st.markdown(
|
921 |
-
st.markdown(
|
922 |
-
st.markdown(
|
923 |
-
st.markdown(
|
924 |
-
st.markdown(
|
925 |
if user_input['preferences']:
|
926 |
-
st.markdown(
|
927 |
if user_input['special_requirements']:
|
928 |
-
st.markdown(
|
929 |
with progress_tab:
|
930 |
if 'progress_placeholder' not in st.session_state:
|
931 |
st.session_state.progress_placeholder = st.empty()
|
@@ -1040,7 +1040,7 @@ Dining Recommendations:
|
|
1040 |
st.session_state.filename = f"{user_input['destination'].replace(' ', '_')}_{date_str}_itinerary.txt"
|
1041 |
|
1042 |
if st.session_state.generation_complete:
|
1043 |
-
st.markdown(
|
1044 |
<div class="modern-card animate-in">
|
1045 |
<div style="display: flex; justify-content: center; margin-bottom: 20px;">
|
1046 |
<div class="success-animation">
|
@@ -1050,8 +1050,8 @@ if st.session_state.generation_complete:
|
|
1050 |
</svg>
|
1051 |
</div>
|
1052 |
</div>
|
1053 |
-
<h2 style="text-align: center; color: #4361ee;">
|
1054 |
-
<p style="text-align: center; color: #6c757d; margin-bottom: 20px;">
|
1055 |
</div>
|
1056 |
|
1057 |
<style>
|
@@ -1100,8 +1100,7 @@ if st.session_state.generation_complete:
|
|
1100 |
""", unsafe_allow_html=True)
|
1101 |
|
1102 |
st.markdown('<div class="modern-card">', unsafe_allow_html=True)
|
1103 |
-
itinerary_tab, details_tab, download_tab = st.tabs([
|
1104 |
-
|
1105 |
with itinerary_tab:
|
1106 |
st.text_area("Your Itinerary", st.session_state.generated_itinerary, height=600)
|
1107 |
with details_tab:
|
@@ -1131,7 +1130,7 @@ if st.session_state.generation_complete:
|
|
1131 |
<h4 style="margin-top: 0;">""" + t("your_itinerary_file") + """</h4>
|
1132 |
<p style="font-size: 0.9rem; color: #6c757d;">""" + t("text_format") + """</p>
|
1133 |
""", unsafe_allow_html=True)
|
1134 |
-
st.markdown(
|
1135 |
st.markdown("</div>", unsafe_allow_html=True)
|
1136 |
st.markdown("### " + t("share_itinerary"))
|
1137 |
st.markdown("*Coming soon: Email your itinerary or share via social media.*")
|
@@ -1148,9 +1147,9 @@ if st.session_state.generation_complete:
|
|
1148 |
st.session_state.results = {}
|
1149 |
st.experimental_rerun()
|
1150 |
|
1151 |
-
st.markdown(
|
1152 |
<div style="margin-top: 50px; text-align: center; padding: 20px; color: #6c757d; font-size: 0.8rem;">
|
1153 |
-
<p>
|
1154 |
</div>
|
1155 |
""", unsafe_allow_html=True)
|
1156 |
|
|
|
593 |
if 'progress_steps' not in st.session_state:
|
594 |
st.session_state.progress_steps = {
|
595 |
0: {'status': 'pending', 'name': t("trip_details")},
|
596 |
+
1: {'status': 'pending', 'name': t("about")},
|
597 |
+
2: {'status': 'pending', 'name': t("travel_style")},
|
598 |
+
3: {'status': 'pending', 'name': t("live_agent_outputs")},
|
599 |
+
4: {'status': 'pending', 'name': t("download_share")},
|
600 |
5: {'status': 'pending', 'name': t("full_itinerary")}
|
601 |
}
|
602 |
|
|
|
611 |
progress_percentage = (current_step / total_steps) * 100
|
612 |
st.progress(progress_percentage / 100)
|
613 |
|
614 |
+
st.markdown("""
|
615 |
<style>
|
616 |
.compact-progress {
|
617 |
background: white;
|
|
|
666 |
}
|
667 |
</style>
|
668 |
<div class="compact-progress">
|
669 |
+
""", unsafe_allow_html=True)
|
670 |
|
671 |
st.markdown('<div class="step-grid">', unsafe_allow_html=True)
|
672 |
for i, step_info in st.session_state.progress_steps.items():
|
|
|
682 |
icon = "β"
|
683 |
status_class = "pending"
|
684 |
|
685 |
+
st.markdown(f"""
|
686 |
<div class="step-item {status_class}">
|
687 |
<span class="step-icon">{icon}</span>
|
688 |
<span class="step-text">{name}</span>
|
689 |
</div>
|
690 |
+
""", unsafe_allow_html=True)
|
691 |
|
692 |
st.markdown('</div></div>', unsafe_allow_html=True)
|
693 |
return progress_percentage
|
|
|
720 |
|
721 |
with output_container:
|
722 |
st.markdown(f"### {task.agent.role} Output")
|
723 |
+
st.markdown("<div class='agent-output'>" + result + "</div>", unsafe_allow_html=True)
|
724 |
|
725 |
return result
|
726 |
|
|
|
751 |
st.session_state.form_submitted = False
|
752 |
|
753 |
# Modern animated header
|
754 |
+
st.markdown(f"""
|
755 |
<div class="animate-in" style="text-align: center;">
|
756 |
<div style="margin-bottom: 20px;">
|
757 |
<img src="https://img.icons8.com/fluency/96/travel-card.png" width="90" style="filter: drop-shadow(0 4px 8px rgba(0,0,0,0.1));">
|
|
|
761 |
β¨ Create your personalized AI-powered travel itinerary in minutes! β¨
|
762 |
</p>
|
763 |
</div>
|
764 |
+
""", unsafe_allow_html=True)
|
765 |
|
766 |
st.markdown('<hr style="height:3px;border:none;background-color:#f0f0f0;margin-bottom:25px;">', unsafe_allow_html=True)
|
767 |
|
768 |
with st.sidebar:
|
769 |
+
st.markdown("""
|
770 |
<div style="text-align: center; padding: 20px 0; margin-bottom: 20px; border-bottom: 1px solid #eaeaea;">
|
771 |
<img src="https://img.icons8.com/fluency/96/travel-card.png" width="80" style="margin-bottom: 15px;">
|
772 |
<h3 style="margin-bottom: 5px; color: #4361ee;">Globetrotter AI: Your AI Agent for Travelling</h3>
|
773 |
<p style="color: #6c757d; font-size: 0.9rem;">AI-Powered Travel Planning</p>
|
774 |
</div>
|
775 |
+
""", unsafe_allow_html=True)
|
776 |
|
777 |
st.markdown('<div class="modern-card">', unsafe_allow_html=True)
|
778 |
+
st.markdown("### π " + t("about"))
|
779 |
st.info("This AI-powered tool creates a personalized travel itinerary based on your preferences. Fill in the form and let our specialized travel agents plan your perfect trip!")
|
780 |
st.markdown('</div>', unsafe_allow_html=True)
|
781 |
|
782 |
st.markdown('<div class="modern-card">', unsafe_allow_html=True)
|
783 |
+
st.markdown("### π " + t("how_it_works"))
|
784 |
st.markdown("""
|
785 |
<ol style="padding-left: 25px;">
|
786 |
<li><b>ποΈ Enter</b> your travel details</li>
|
|
|
802 |
("π
Itinerary Creator", "Puts everything together in a daily plan")
|
803 |
]
|
804 |
for name, desc in agents:
|
805 |
+
st.markdown("**" + name + "**")
|
806 |
+
st.markdown("<small>" + desc + "</small>", unsafe_allow_html=True)
|
807 |
st.markdown('</div>', unsafe_allow_html=True)
|
808 |
|
809 |
if not st.session_state.generation_complete:
|
810 |
st.markdown('<div class="modern-card animate-in">', unsafe_allow_html=True)
|
811 |
+
st.markdown("<h3 style='font-weight: 600; color: var(--primary-dark); display: flex; align-items: center; gap: 10px;'><span style='font-size: 20px;'>βοΈ</span> " + t("create_itinerary") + "</h3>", unsafe_allow_html=True)
|
812 |
|
813 |
st.markdown("""
|
814 |
<p style="color: var(--text-light); margin-bottom: 16px; font-size: 14px; font-weight: 400;">Complete the form below for a personalized travel plan.</p>
|
|
|
824 |
start_date = st.date_input("Start Date", min_value=datetime.now(), label_visibility="collapsed")
|
825 |
duration = st.slider(t("duration"), min_value=1, max_value=30, value=7)
|
826 |
end_date = start_date + timedelta(days=duration-1)
|
827 |
+
st.markdown('<p style="font-size: 13px; color: var(--text-muted); margin-top: 5px;">' + start_date.strftime("%b %d") + " - " + end_date.strftime("%b %d, %Y") + '</p>', unsafe_allow_html=True)
|
828 |
with col2:
|
829 |
st.markdown('<p style="font-weight: 500; color: var(--primary); font-size: 14px; margin-bottom: 12px;">Preferences</p>', unsafe_allow_html=True)
|
830 |
travelers = st.number_input("Travelers", min_value=1, max_value=15, value=2)
|
|
|
917 |
progress_tab, logs_tab, details_tab = st.tabs(["π Progress", "π Live Activity", "π " + t("request_details")])
|
918 |
with details_tab:
|
919 |
st.markdown("#### " + t("request_details"))
|
920 |
+
st.markdown("**" + t("destination") + ":** " + user_input['destination'])
|
921 |
+
st.markdown("**" + t("from") + ":** " + user_input['origin'])
|
922 |
+
st.markdown("**" + t("when") + ":** " + user_input['travel_dates'] + " (" + user_input['duration'] + " days)")
|
923 |
+
st.markdown("**" + t("budget") + ":** " + user_input['budget'].title())
|
924 |
+
st.markdown("**" + t("travel_style") + ":** " + user_input['travel_style'])
|
925 |
if user_input['preferences']:
|
926 |
+
st.markdown("**Interests:** " + user_input['preferences'])
|
927 |
if user_input['special_requirements']:
|
928 |
+
st.markdown("**Special Requirements:** " + user_input['special_requirements'])
|
929 |
with progress_tab:
|
930 |
if 'progress_placeholder' not in st.session_state:
|
931 |
st.session_state.progress_placeholder = st.empty()
|
|
|
1040 |
st.session_state.filename = f"{user_input['destination'].replace(' ', '_')}_{date_str}_itinerary.txt"
|
1041 |
|
1042 |
if st.session_state.generation_complete:
|
1043 |
+
st.markdown("""
|
1044 |
<div class="modern-card animate-in">
|
1045 |
<div style="display: flex; justify-content: center; margin-bottom: 20px;">
|
1046 |
<div class="success-animation">
|
|
|
1050 |
</svg>
|
1051 |
</div>
|
1052 |
</div>
|
1053 |
+
<h2 style="text-align: center; color: #4361ee;">""" + t("itinerary_ready") + """</h2>
|
1054 |
+
<p style="text-align: center; color: #6c757d; margin-bottom: 20px;">""" + t("personalized_experience") + """</p>
|
1055 |
</div>
|
1056 |
|
1057 |
<style>
|
|
|
1100 |
""", unsafe_allow_html=True)
|
1101 |
|
1102 |
st.markdown('<div class="modern-card">', unsafe_allow_html=True)
|
1103 |
+
itinerary_tab, details_tab, download_tab = st.tabs(["ποΈ " + t("full_itinerary"), "πΌ " + t("details"), "πΎ " + t("download_share")])
|
|
|
1104 |
with itinerary_tab:
|
1105 |
st.text_area("Your Itinerary", st.session_state.generated_itinerary, height=600)
|
1106 |
with details_tab:
|
|
|
1130 |
<h4 style="margin-top: 0;">""" + t("your_itinerary_file") + """</h4>
|
1131 |
<p style="font-size: 0.9rem; color: #6c757d;">""" + t("text_format") + """</p>
|
1132 |
""", unsafe_allow_html=True)
|
1133 |
+
st.markdown("<div style='margin: 10px 0;'>" + get_download_link(st.session_state.generated_itinerary, st.session_state.filename) + "</div>", unsafe_allow_html=True)
|
1134 |
st.markdown("</div>", unsafe_allow_html=True)
|
1135 |
st.markdown("### " + t("share_itinerary"))
|
1136 |
st.markdown("*Coming soon: Email your itinerary or share via social media.*")
|
|
|
1147 |
st.session_state.results = {}
|
1148 |
st.experimental_rerun()
|
1149 |
|
1150 |
+
st.markdown("""
|
1151 |
<div style="margin-top: 50px; text-align: center; padding: 20px; color: #6c757d; font-size: 0.8rem;">
|
1152 |
+
<p>""" + t("built_with") + """</p>
|
1153 |
</div>
|
1154 |
""", unsafe_allow_html=True)
|
1155 |
|