Mavhas commited on
Commit
474f2fa
·
verified ·
1 Parent(s): 1c062c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -0
app.py CHANGED
@@ -0,0 +1,51 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # app.py
2
+ import streamlit as st
3
+ import pandas as pd
4
+
5
+ st.set_page_config(page_title="Aircraft Information App", page_icon=":airplane:", layout="wide")
6
+
7
+ # Load aircraft data (replace with your actual data source)
8
+ # You can use a CSV, Excel file, or a database connection
9
+ try:
10
+ aircraft_data = pd.read_csv("aircraft_data.csv") # Example: Load from CSV
11
+ except FileNotFoundError:
12
+ st.error("aircraft_data.csv not found. Please upload the data file.")
13
+ st.stop() # Stop execution if file not found
14
+
15
+ # Streamlit app
16
+ st.title("Aircraft Information App")
17
+
18
+ # Aircraft selection
19
+ aircraft_names = aircraft_data["Aircraft Name"].unique() # Get unique aircraft names
20
+ selected_aircraft = st.selectbox("Select an Aircraft", aircraft_names)
21
+
22
+ # Display aircraft information
23
+ if selected_aircraft:
24
+ aircraft_info = aircraft_data[aircraft_data["Aircraft Name"] == selected_aircraft].iloc[0] # Get info for selected aircraft
25
+
26
+ st.subheader(aircraft_info["Aircraft Name"])
27
+ st.image(aircraft_info["Image URL"], use_column_width=True, caption=aircraft_info["Aircraft Name"]) # Display image
28
+
29
+ # Display information in columns for better layout
30
+ col1, col2 = st.columns(2)
31
+
32
+ with col1:
33
+ st.write(f"**Origin:** {aircraft_info['Origin']}")
34
+ st.write(f"**Manufacturer:** {aircraft_info['Manufacturer']}")
35
+ st.write(f"**First Flight:** {aircraft_info['First Flight']}")
36
+ st.write(f"**Introduction:** {aircraft_info['Introduction']}")
37
+ st.write(f"**Role:** {aircraft_info['Role']}") # Example: Add more fields as needed
38
+
39
+ with col2:
40
+ st.write(f"**Variants:** {aircraft_info['Variants']}")
41
+ st.write(f"**Crew:** {aircraft_info['Crew']}")
42
+ st.write(f"**Capacity:** {aircraft_info['Capacity']}")
43
+ st.write(f"**Length:** {aircraft_info['Length']}")
44
+ st.write(f"**Wingspan:** {aircraft_info['Wingspan']}") # Example: Add more fields as needed
45
+
46
+ # Add a collapsible expander for more detailed description
47
+ with st.expander("Detailed Description"):
48
+ st.write(aircraft_info["Description"]) # Display the description
49
+
50
+ else:
51
+ st.write("Please select an aircraft to view its information.")