-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathstreamlit_app.py
88 lines (71 loc) · 3.04 KB
/
streamlit_app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import os
import logging
from logging import INFO
import sys
import streamlit as st
from utils.stream_to_expander import StreamToExpander
from crew.trip_crew import TripCrew
logging.getLogger(__name__)
logging.basicConfig(
format='%(asctime)s - %(name)s - %(levelname)s - %(message)s', level=INFO)
logging.info("Starting app")
st.set_page_config(page_icon="✈️", layout="wide")
os.environ["LITELLM_LOG"] = "DEBUG"
def icon(emoji: str):
"""Shows an emoji as a Notion-style page icon."""
st.write(
f'<span style="font-size: 78px; line-height: 1">{emoji}</span>',
unsafe_allow_html=True,
)
if __name__ == "__main__":
icon("🏖️ VacAIgent")
st.subheader("Let AI agents plan your next vacation!",
divider="rainbow", anchor=False)
import datetime
today = datetime.datetime.now().date()
next_year = today.year + 1
jan_16_next_year = datetime.date(next_year, 1, 10)
with st.sidebar:
st.header("👇 Enter your trip details")
with st.form("my_form"):
location = st.text_input(
"Where are you currently located?", placeholder="San Mateo, CA")
cities = st.text_input(
"City and country are you interested in vacationing at?", placeholder="Bali, Indonesia")
date_range = st.date_input(
"Date range you are interested in traveling?",
min_value=today,
value=(today, jan_16_next_year + datetime.timedelta(days=6)),
format="MM/DD/YYYY",
)
interests = st.text_area("High level interests and hobbies or extra details about your trip?",
placeholder="2 adults who love swimming, dancing, hiking, and eating")
submitted = st.form_submit_button("Submit")
st.divider()
# Credits to joaomdmoura/CrewAI for the code: https://github.com/joaomdmoura/crewAI
st.sidebar.markdown(
"""
Credits to [**@joaomdmoura**](https://twitter.com/joaomdmoura)
for creating **crewAI** 🚀
""",
unsafe_allow_html=True
)
st.sidebar.info("Click the logo to visit GitHub repo", icon="👇")
st.sidebar.markdown(
"""
<a href="https://github.com/joaomdmoura/crewAI" target="_blank">
<img src="https://raw.githubusercontent.com/joaomdmoura/crewAI/main/docs/crewai_logo.png" alt="CrewAI Logo" style="width:100px;"/>
</a>
""",
unsafe_allow_html=True
)
if submitted:
with st.status("🤖 **Agents at work...**", state="running", expanded=True) as status:
with st.container(height=500, border=False):
sys.stdout = StreamToExpander(st)
trip_crew = TripCrew(location, cities, date_range, interests)
result = trip_crew.run()
status.update(label="✅ Trip Plan Ready!",
state="complete", expanded=False)
st.subheader("Here is your Trip Plan", anchor=False, divider="rainbow")
st.markdown(result)