Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
Airline Dataset
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Dhruvang Patel
Airline Dataset
Compare revisions
cccb9ec1c8d8ab5291fd36f2e4513e3167e0810b to 71710f99da93bc1d86208a394c77ac34c4d0e149
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
dp08142/assistance-system
Select target project
No results found
71710f99da93bc1d86208a394c77ac34c4d0e149
Select Git revision
Branches
main
Swap
Target
dp08142/assistance-system
Select target project
dp08142/assistance-system
1 result
cccb9ec1c8d8ab5291fd36f2e4513e3167e0810b
Select Git revision
Branches
main
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (2)
main Streamlit File
· 44b91326
jevin3107
authored
2 months ago
44b91326
Merge branch 'main' of
https://mygit.th-deg.de/dp08142/assistance-system
· 71710f99
jevin3107
authored
2 months ago
71710f99
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app.py
+28
-15
28 additions, 15 deletions
app.py
with
28 additions
and
15 deletions
app.py
View file @
71710f99
...
...
@@ -80,9 +80,9 @@ def show_chatbot_section():
# Greeting and initial input
if
not
st
.
session_state
.
greeted
:
user_input
=
st
.
text_input
(
"
Start by saying
'
Hey
'
,
'
Good Morning
'
, or
'
Hello
'
:
"
)
user_input
=
st
.
text_input
(
"
Start by saying
'
Hey
'
,
'
Good Morning
'
, or
ask your question
:
"
)
if
user_input
:
if
any
(
greet
in
user_input
.
lower
()
for
greet
in
[
"
hey
"
,
"
good morning
"
,
"
hello
"
,
"
hi
"
,
"
greetings
"
]):
if
any
(
greet
in
user_input
.
lower
()
for
greet
in
[
"
hey
"
,
"
good morning
"
,
"
hello
"
,
"
hi
"
]):
st
.
write
(
"
Hello! How can I assist you today?
"
)
st
.
session_state
.
greeted
=
True
else
:
...
...
@@ -90,15 +90,15 @@ def show_chatbot_section():
# Respond to user query
if
st
.
session_state
.
greeted
and
not
st
.
session_state
.
help_query
:
user_query
=
st
.
text_input
(
"
What would you like assistance with?
(e.g.,
'
I want to know my flight details
'
):
"
)
user_query
=
st
.
text_input
(
"
What would you like assistance with?
"
)
if
user_query
:
if
"
details
"
in
user_query
.
lower
():
st
.
success
(
"
Understood, let
'
s proceed
to fetch your details
.
"
)
if
any
(
keyword
in
user_query
.
lower
()
for
keyword
in
[
"
details
"
,
"
my details
"
,
"
know my details
"
])
:
st
.
success
(
"
Understood, let
'
s proceed.
"
)
st
.
session_state
.
help_query
=
True
else
:
st
.
info
(
"
Let me know how I can assist you further.
"
)
#
Fetch and display user details
#
Passenger ID and Last Name functionality
if
st
.
session_state
.
help_query
and
not
st
.
session_state
.
details_fetched
:
passenger_id
=
st
.
text_input
(
"
Please enter your Passenger ID:
"
)
last_name
=
st
.
text_input
(
"
Please enter your Last Name:
"
)
...
...
@@ -109,11 +109,23 @@ def show_chatbot_section():
elif
not
last_name
:
st
.
warning
(
"
Please enter your Last Name.
"
)
else
:
result
=
df
[
df
[
"
Passenger ID
"
]
==
passenger_id
]
result
=
df
[
df
.
applymap
(
lambda
x
:
passenger_id
.
lower
()
in
str
(
x
).
lower
()
if
pd
.
notnull
(
x
)
else
False
).
any
(
axis
=
1
)
]
result
=
result
[
result
[
"
Last Name
"
].
str
.
lower
()
==
last_name
.
lower
()]
if
not
result
.
empty
:
st
.
success
(
"
Here are your flight details:
"
)
st
.
write
(
result
)
st
.
success
(
"
**Here are your flight details:**
"
)
for
index
,
row
in
result
.
iterrows
():
st
.
markdown
(
f
"
**Passenger ID:** <code>
{
row
[
'
Passenger ID
'
]
}
</code>
"
,
unsafe_allow_html
=
True
)
st
.
markdown
(
f
"
**First Name:** <code>
{
row
[
'
First Name
'
]
}
</code>
"
,
unsafe_allow_html
=
True
)
st
.
markdown
(
f
"
**Last Name:** <code>
{
row
[
'
Last Name
'
]
}
</code>
"
,
unsafe_allow_html
=
True
)
st
.
markdown
(
f
"
**Gender:** <code>
{
row
[
'
Gender
'
]
}
</code>
"
,
unsafe_allow_html
=
True
)
st
.
markdown
(
f
"
**Age:** <code>
{
row
[
'
Age
'
]
}
</code>
"
,
unsafe_allow_html
=
True
)
st
.
markdown
(
f
"
**Nationality:** <code>
{
row
[
'
Nationality
'
]
}
</code>
"
,
unsafe_allow_html
=
True
)
st
.
markdown
(
f
"
**Airport Name:** <code>
{
row
[
'
Airport Name
'
]
}
</code>
"
,
unsafe_allow_html
=
True
)
st
.
markdown
(
f
"
**Departure Date:** <code>
{
row
[
'
Departure Date
'
]
}
</code>
"
,
unsafe_allow_html
=
True
)
st
.
markdown
(
f
"
**Arrival Airport:** <code>
{
row
[
'
Arrival Airport
'
]
}
</code>
"
,
unsafe_allow_html
=
True
)
st
.
markdown
(
f
"
**Pilot Name:** <code>
{
row
[
'
Pilot Name
'
]
}
</code>
"
,
unsafe_allow_html
=
True
)
st
.
markdown
(
f
"
**Flight Status:** <code>
{
row
[
'
Flight Status
'
]
}
</code>
"
,
unsafe_allow_html
=
True
)
st
.
write
(
"
---
"
)
st
.
session_state
.
details_fetched
=
True
else
:
st
.
error
(
"
No matching records found. Please check the Passenger ID or Last Name.
"
)
...
...
@@ -122,17 +134,18 @@ def show_chatbot_section():
if
st
.
session_state
.
details_fetched
and
not
st
.
session_state
.
farewell
:
further_assistance
=
st
.
text_input
(
"
Do you need any further assistance? (Yes/No)
"
)
if
further_assistance
:
if
further_assistance
.
lower
()
==
"
no
"
:
st
.
success
(
"
Thank you! Have a great day
!
"
)
if
"
no
"
in
further_assistance
.
lower
()
or
"
goodbye
"
in
further_assistance
.
lower
()
:
st
.
success
(
"
Happy to assist you
!
"
)
st
.
session_state
.
farewell
=
True
elif
further_assistance
.
lower
()
==
"
yes
"
:
st
.
info
(
"
Please describe your next query.
"
)
elif
"
yes
"
in
further_assistance
.
lower
():
st
.
info
(
"
Please describe your next query
or ask for more details
.
"
)
else
:
st
.
warning
(
"
Please respond with
'
Yes
'
or
'
No
'
.
"
)
# Reset
chatbot
after farewell
# Reset
message
after farewell
if
st
.
session_state
.
farewell
:
st
.
info
(
"
Press the Reset Chatbot button to restart the conversation.
"
)
st
.
info
(
"
Press the **Reset Chatbot** button to restart the conversation and ask for other details.
"
)
def
show_data_explorer_section
():
st
.
subheader
(
"
Explore the Airline Dataset
"
)
...
...
This diff is collapsed.
Click to expand it.