Shivam77 commited on
Commit
69e0998
·
verified ·
1 Parent(s): 98d2a5e

Delete app.py

Browse files
Files changed (1) hide show
  1. app.py +0 -77
app.py DELETED
@@ -1,77 +0,0 @@
1
- import streamlit as st
2
- import altair as alt
3
- from constants import delay_category
4
- import gdown
5
- import pandas as pd
6
- from pydantic.v1 import BaseSettings
7
- from streamlit_pandas_profiling import st_profile_report
8
- from streamlit_extras.switch_page_button import switch_page
9
-
10
- st.set_page_config(page_title='Flight Never Delay', page_icon = '✈️', layout = 'centered', initial_sidebar_state = 'expanded')
11
-
12
- """
13
- @st.cache(suppress_st_warning=True)
14
- def get_data(filename):
15
- url = "https://drive.google.com/uc?id=1-4OXefZDioyrobHyhtBfAFMNMem_XmLp"
16
- output = filename
17
- gdown.download(url, output, quiet=False)
18
- """
19
- @st.cache(suppress_st_warning=True)
20
- def profiler(df):
21
- pr = df.profile_report()
22
- st_profile_report(pr)
23
-
24
- def intro():
25
- st.header("Project Flight Never Delay ✈️")
26
- st.markdown("As frequent travelers, our team members often experience flight delays and cancellations.\
27
- However, there is no good way for us to be informed on whether a flight will be delayed or cancelled in advance.")
28
-
29
- st.markdown("To address our problem, we built a flight delay and cancellation prediction model using previous \
30
- flight delay data from the [Bureau of Transportation Statistics - On-Time : Marketing Carrier On-Time Performance dataset](https://www.transtats.bts.gov/DL_SelectFields.aspx?gnoyr_VQ=FGK&QO_fu146_anzr=b0-gvzr). \
31
- We further augmented our dataset with fine-grained geographic information by mapping airports to US state \
32
- names and coordinates (latitude and longitude) from a [Kaggle dataset](https://www.kaggle.com/datasets/usdot/flight-delays?select=airports.csv).")
33
-
34
- st.markdown("After data cleaning, we have a dataset of 1,141,693 flight delays from 2021 covering information such as flight time, \
35
- flight carrier, flight origin and destinations, flight delay times and reasons, flight cancellations and reasons, and geographical information. You may view \
36
- the full dataset at the bottom of the page.")
37
-
38
- # st.write("Cancel rate: 9.38 %")
39
- # st.write("Average delay time: 66.63 minutes")
40
- # df = pd.DataFrame(
41
- # {"reasons of delay": list(delay_category.keys()), "value": list(delay_category.values())}
42
- # )
43
- # pie_chart = alt.Chart(df).mark_arc().encode(
44
- # theta=alt.Theta(field="value", type="quantitative"),
45
- # color=alt.Color(field="reasons of delay", type="nominal"),
46
- # )
47
- # st.altair_chart(pie_chart)
48
-
49
- if __name__ == '__main__':
50
- # st.set_page_config(layout="wide")
51
- #st.set_page_config(page_title='Flight Never Delay', page_icon = '✈️', layout = 'centered', initial_sidebar_state = 'expanded')
52
- intro()
53
- st.write("Click on one of the following buttons to continue.")
54
- if st.button("Visualize correlations in the data! 📊"):
55
- switch_page("Visualization")
56
- if st.button("Predict my flight! 🧠"):
57
- switch_page("Prediction")
58
- st.markdown("""---""")
59
- filename = "data-coordinates.csv"
60
- #get_data(filename)
61
- df = pd.read_csv(filename)
62
- with st.expander("View full dataset"):
63
- st.subheader("Dataset")
64
- st.dataframe(df)
65
- # if st.checkbox("Generate data profile (this takes several minutes as the dataset is large)"):
66
- # profiler(df)
67
-
68
- # nav = st.sidebar.radio("Navigation",
69
- # ("Introduction", "Visualization", "Prediction"))
70
- # if nav == "Introduction":
71
- # intro()
72
- # elif nav == "Visualization":
73
- # vis()
74
- # else:
75
- # pred()
76
-
77
- # profiler(filename)