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
ee919edc9a4f07de7e01637f0d5b89c7464c0299 to 692fea7e3e6364d0278caf2ef18941e8825f6e4c
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
692fea7e3e6364d0278caf2ef18941e8825f6e4c
Select Git revision
Branches
main
Swap
Target
dp08142/assistance-system
Select target project
dp08142/assistance-system
1 result
ee919edc9a4f07de7e01637f0d5b89c7464c0299
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
· e9989a88
jevin3107
authored
2 months ago
e9989a88
Merge branch 'main' of
https://mygit.th-deg.de/dp08142/assistance-system
· 692fea7e
jevin3107
authored
2 months ago
692fea7e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
app.py
+74
-1
74 additions, 1 deletion
app.py
with
74 additions
and
1 deletion
app.py
View file @
692fea7e
...
...
@@ -59,7 +59,80 @@ menu = st.sidebar.selectbox("Select a Feature", ["Chatbot", "Data Explorer", "Vi
def
show_chatbot_section
():
st
.
subheader
(
"
Chat with Airline Assistant
"
)
st
.
write
(
"
Chatbot functionality goes here...
"
)
# Initialize session states for conversation flow
if
"
greeted
"
not
in
st
.
session_state
:
st
.
session_state
.
greeted
=
False
if
"
help_query
"
not
in
st
.
session_state
:
st
.
session_state
.
help_query
=
False
if
"
details_fetched
"
not
in
st
.
session_state
:
st
.
session_state
.
details_fetched
=
False
if
"
farewell
"
not
in
st
.
session_state
:
st
.
session_state
.
farewell
=
False
# Reset button functionality
if
st
.
button
(
"
Reset Chatbot
"
):
st
.
session_state
.
greeted
=
False
st
.
session_state
.
help_query
=
False
st
.
session_state
.
details_fetched
=
False
st
.
session_state
.
farewell
=
False
st
.
success
(
"
The chatbot has been reset. How can I help you?
"
)
# Greeting and initial input
if
not
st
.
session_state
.
greeted
:
user_input
=
st
.
text_input
(
"
Start by saying
'
Hey
'
,
'
Good Morning
'
, or
'
Hello
'
:
"
)
if
user_input
:
if
any
(
greet
in
user_input
.
lower
()
for
greet
in
[
"
hey
"
,
"
good morning
"
,
"
hello
"
,
"
hi
"
,
"
greetings
"
]):
st
.
write
(
"
Hello! How can I assist you today?
"
)
st
.
session_state
.
greeted
=
True
else
:
st
.
warning
(
"
Please start with a greeting like
'
Hey
'
or
'
Good Morning
'
.
"
)
# 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
'
):
"
)
if
user_query
:
if
"
details
"
in
user_query
.
lower
():
st
.
success
(
"
Understood, let
'
s proceed to fetch your details.
"
)
st
.
session_state
.
help_query
=
True
else
:
st
.
info
(
"
Let me know how I can assist you further.
"
)
# Fetch and display user details
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:
"
)
if
st
.
button
(
"
Get Flight Details
"
):
if
not
passenger_id
:
st
.
warning
(
"
Please enter your Passenger ID.
"
)
elif
not
last_name
:
st
.
warning
(
"
Please enter your Last Name.
"
)
else
:
result
=
df
[
df
[
"
Passenger ID
"
]
==
passenger_id
]
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
.
session_state
.
details_fetched
=
True
else
:
st
.
error
(
"
No matching records found. Please check the Passenger ID or Last Name.
"
)
# Further assistance or goodbye
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!
"
)
st
.
session_state
.
farewell
=
True
elif
further_assistance
.
lower
()
==
"
yes
"
:
st
.
info
(
"
Please describe your next query.
"
)
else
:
st
.
warning
(
"
Please respond with
'
Yes
'
or
'
No
'
.
"
)
# Reset chatbot after farewell
if
st
.
session_state
.
farewell
:
st
.
info
(
"
Press the Reset Chatbot button to restart the conversation.
"
)
def
show_data_explorer_section
():
st
.
subheader
(
"
Explore the Airline Dataset
"
)
...
...
This diff is collapsed.
Click to expand it.