Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,19 +2,19 @@ import streamlit as st
|
|
| 2 |
import pandas as pd
|
| 3 |
import os
|
| 4 |
|
| 5 |
-
st.set_page_config(page_title="
|
| 6 |
|
| 7 |
-
#
|
| 8 |
aircraft_data = {
|
| 9 |
"F-16": {
|
| 10 |
"Aircraft Name": "General Dynamics F-16 Fighting Falcon",
|
| 11 |
-
"Image URL": "f16.jpg", # Replace with
|
| 12 |
"Origin": "United States",
|
| 13 |
-
"Manufacturer": "General Dynamics",
|
| 14 |
"First Flight": 1974,
|
| 15 |
"Introduction": 1979,
|
| 16 |
"Role": "Multirole fighter",
|
| 17 |
-
"Variants": "
|
| 18 |
"Crew": 1,
|
| 19 |
"Capacity": "N/A",
|
| 20 |
"Length (m)": 15.03,
|
|
@@ -23,18 +23,56 @@ aircraft_data = {
|
|
| 23 |
"Max Speed (km/h)": 2414,
|
| 24 |
"Range (km)": 3400,
|
| 25 |
"Service Ceiling (m)": 15240,
|
| 26 |
-
"Description": "The
|
| 27 |
},
|
| 28 |
-
"F-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 29 |
"Aircraft Name": "McDonnell Douglas F-15 Eagle",
|
| 30 |
-
"Image URL": "f15.jpg", # Replace with
|
| 31 |
"Origin": "United States",
|
| 32 |
"Manufacturer": "McDonnell Douglas (now Boeing)",
|
| 33 |
"First Flight": 1972,
|
| 34 |
"Introduction": 1976,
|
| 35 |
"Role": "Air superiority fighter",
|
| 36 |
"Variants": "F-15A, F-15B, F-15C, F-15D, F-15E",
|
| 37 |
-
"Crew": 1 (F-15C/E), 2 (F-15B/D)
|
| 38 |
"Capacity": "N/A",
|
| 39 |
"Length (m)": 19.43,
|
| 40 |
"Wingspan (m)": 13.05,
|
|
@@ -42,52 +80,46 @@ aircraft_data = {
|
|
| 42 |
"Max Speed (km/h)": 3000+,
|
| 43 |
"Range (km)": 4445,
|
| 44 |
"Service Ceiling (m)": 18000+,
|
| 45 |
-
"Description": "The
|
| 46 |
}
|
| 47 |
}
|
| 48 |
|
| 49 |
-
st.title("Fighter Information")
|
| 50 |
|
| 51 |
-
|
| 52 |
-
|
|
|
|
|
|
|
| 53 |
|
| 54 |
if selected_aircraft:
|
| 55 |
-
aircraft_info =
|
| 56 |
|
| 57 |
-
st.
|
| 58 |
|
|
|
|
| 59 |
image_path = aircraft_info["Image URL"]
|
| 60 |
-
|
| 61 |
if image_path:
|
| 62 |
if os.path.exists(image_path):
|
| 63 |
st.image(image_path, use_column_width=True, caption=aircraft_info["Aircraft Name"])
|
| 64 |
else:
|
| 65 |
-
|
| 66 |
-
st.image(image_path, use_column_width=True, caption=aircraft_info["Aircraft Name"])
|
| 67 |
-
except Exception as e:
|
| 68 |
-
st.error(f"Error displaying image: {e}. Check the URL/path in the CSV.") # Modified error message
|
| 69 |
else:
|
| 70 |
-
st.warning("No image URL provided
|
|
|
|
| 71 |
|
| 72 |
-
col1, col2 = st.columns(2)
|
| 73 |
|
| 74 |
with col1:
|
| 75 |
-
st.
|
| 76 |
-
|
| 77 |
-
|
| 78 |
-
|
| 79 |
-
st.write(f"**Role:** {aircraft_info['Role']}")
|
| 80 |
|
| 81 |
with col2:
|
| 82 |
-
st.
|
| 83 |
-
|
| 84 |
-
|
| 85 |
-
|
| 86 |
-
st.write(f"**Wingspan:** {aircraft_info['Wingspan (m)']} m")
|
| 87 |
-
st.write(f"**Height:** {aircraft_info['Height (m)']} m")
|
| 88 |
-
st.write(f"**Max Speed:** {aircraft_info['Max Speed (km/h)']} km/h")
|
| 89 |
-
st.write(f"**Range:** {aircraft_info['Range (km)']} km")
|
| 90 |
-
st.write(f"**Service Ceiling:** {aircraft_info['Service Ceiling (m)']} m")
|
| 91 |
|
| 92 |
-
with st.expander("Detailed Description"):
|
| 93 |
st.write(aircraft_info["Description"])
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
import os
|
| 4 |
|
| 5 |
+
st.set_page_config(page_title="Fighter Aircraft Information", page_icon=":airplane:", layout="wide")
|
| 6 |
|
| 7 |
+
# Aircraft Data (Dictionary)
|
| 8 |
aircraft_data = {
|
| 9 |
"F-16": {
|
| 10 |
"Aircraft Name": "General Dynamics F-16 Fighting Falcon",
|
| 11 |
+
"Image URL": "f16.jpg", # Replace with actual filename
|
| 12 |
"Origin": "United States",
|
| 13 |
+
"Manufacturer": "General Dynamics (now Lockheed Martin)",
|
| 14 |
"First Flight": 1974,
|
| 15 |
"Introduction": 1979,
|
| 16 |
"Role": "Multirole fighter",
|
| 17 |
+
"Variants": "Numerous variants (A, B, C, D, E, F, etc.)",
|
| 18 |
"Crew": 1,
|
| 19 |
"Capacity": "N/A",
|
| 20 |
"Length (m)": 15.03,
|
|
|
|
| 23 |
"Max Speed (km/h)": 2414,
|
| 24 |
"Range (km)": 3400,
|
| 25 |
"Service Ceiling (m)": 15240,
|
| 26 |
+
"Description": "The F-16 is a highly versatile, multirole fighter, known for its speed, agility, and adaptability. It has served in numerous conflicts and remains a mainstay of many air forces."
|
| 27 |
},
|
| 28 |
+
"F-35": {
|
| 29 |
+
"Aircraft Name": "Lockheed Martin F-35 Lightning II",
|
| 30 |
+
"Image URL": "f35.jpg", # Replace with actual filename
|
| 31 |
+
"Origin": "United States",
|
| 32 |
+
"Manufacturer": "Lockheed Martin",
|
| 33 |
+
"First Flight": 2006,
|
| 34 |
+
"Introduction": 2015,
|
| 35 |
+
"Role": "Multirole fighter (stealth)",
|
| 36 |
+
"Variants": "F-35A, F-35B, F-35C",
|
| 37 |
+
"Crew": 1,
|
| 38 |
+
"Capacity": "N/A",
|
| 39 |
+
"Length (m)": 15.67,
|
| 40 |
+
"Wingspan (m)": 10.7,
|
| 41 |
+
"Height (m)": 4.33,
|
| 42 |
+
"Max Speed (km/h)": 1930,
|
| 43 |
+
"Range (km)": 2220,
|
| 44 |
+
"Service Ceiling (m)": 18288,
|
| 45 |
+
"Description": "The F-35 is a fifth-generation, stealth multirole fighter. It is designed for air superiority, strike missions, and electronic warfare, and is notable for its advanced technology and sensor fusion."
|
| 46 |
+
},
|
| 47 |
+
"F-22": {
|
| 48 |
+
"Aircraft Name": "Lockheed Martin F-22 Raptor",
|
| 49 |
+
"Image URL": "f22.jpg", # Replace with actual filename
|
| 50 |
+
"Origin": "United States",
|
| 51 |
+
"Manufacturer": "Lockheed Martin",
|
| 52 |
+
"First Flight": 1997,
|
| 53 |
+
"Introduction": 2005,
|
| 54 |
+
"Role": "Air superiority fighter (stealth)",
|
| 55 |
+
"Variants": "F-22A",
|
| 56 |
+
"Crew": 1,
|
| 57 |
+
"Capacity": "N/A",
|
| 58 |
+
"Length (m)": 18.92,
|
| 59 |
+
"Wingspan (m)": 13.56,
|
| 60 |
+
"Height (m)": 5.08,
|
| 61 |
+
"Max Speed (km/h)": 2414+,
|
| 62 |
+
"Range (km)": 2900,
|
| 63 |
+
"Service Ceiling (m)": 20000+,
|
| 64 |
+
"Description": "The F-22 Raptor is a fifth-generation, stealth air superiority fighter. It is considered one of the most advanced and capable fighter aircraft in the world, known for its exceptional stealth, speed, and maneuverability."
|
| 65 |
+
},
|
| 66 |
+
"F-15": { # Duplicate entry for distinct display
|
| 67 |
"Aircraft Name": "McDonnell Douglas F-15 Eagle",
|
| 68 |
+
"Image URL": "f15.jpg", # Replace with actual filename
|
| 69 |
"Origin": "United States",
|
| 70 |
"Manufacturer": "McDonnell Douglas (now Boeing)",
|
| 71 |
"First Flight": 1972,
|
| 72 |
"Introduction": 1976,
|
| 73 |
"Role": "Air superiority fighter",
|
| 74 |
"Variants": "F-15A, F-15B, F-15C, F-15D, F-15E",
|
| 75 |
+
"Crew": "1 (F-15C/E), 2 (F-15B/D)",
|
| 76 |
"Capacity": "N/A",
|
| 77 |
"Length (m)": 19.43,
|
| 78 |
"Wingspan (m)": 13.05,
|
|
|
|
| 80 |
"Max Speed (km/h)": 3000+,
|
| 81 |
"Range (km)": 4445,
|
| 82 |
"Service Ceiling (m)": 18000+,
|
| 83 |
+
"Description": "The F-15 Eagle is a twin-engine, all-weather tactical fighter designed for air superiority. It has a long combat record and is highly regarded for its speed, range, and weapons payload."
|
| 84 |
}
|
| 85 |
}
|
| 86 |
|
| 87 |
+
st.title("Fighter Aircraft Information")
|
| 88 |
|
| 89 |
+
# Sidebar for selection
|
| 90 |
+
st.sidebar.title("Select Aircraft")
|
| 91 |
+
aircraft_names = list(aircraft_data.keys())
|
| 92 |
+
selected_aircraft = st.sidebar.selectbox("Choose an aircraft:", aircraft_names)
|
| 93 |
|
| 94 |
if selected_aircraft:
|
| 95 |
+
aircraft_info = aircraft_data[selected_aircraft]
|
| 96 |
|
| 97 |
+
st.header(aircraft_info["Aircraft Name"]) # More prominent header
|
| 98 |
|
| 99 |
+
# Image display with improved error handling
|
| 100 |
image_path = aircraft_info["Image URL"]
|
|
|
|
| 101 |
if image_path:
|
| 102 |
if os.path.exists(image_path):
|
| 103 |
st.image(image_path, use_column_width=True, caption=aircraft_info["Aircraft Name"])
|
| 104 |
else:
|
| 105 |
+
st.error(f"Image not found: {image_path}")
|
|
|
|
|
|
|
|
|
|
| 106 |
else:
|
| 107 |
+
st.warning("No image URL provided.")
|
| 108 |
+
|
| 109 |
|
| 110 |
+
col1, col2 = st.columns(2) # Two-column layout for information
|
| 111 |
|
| 112 |
with col1:
|
| 113 |
+
st.subheader("General Information") # Subheader for organization
|
| 114 |
+
for key, value in aircraft_info.items():
|
| 115 |
+
if key not in ["Aircraft Name", "Image URL", "Description"]: # Exclude these
|
| 116 |
+
st.write(f"**{key}:** {value}")
|
|
|
|
| 117 |
|
| 118 |
with col2:
|
| 119 |
+
st.subheader("Performance Specs") # Subheader for organization
|
| 120 |
+
for key, value in aircraft_info.items():
|
| 121 |
+
if key in ["Length (m)", "Wingspan (m)", "Height (m)", "Max Speed (km/h)", "Range (km)", "Service Ceiling (m)"]:
|
| 122 |
+
st.write(f"**{key}:** {value}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 123 |
|
| 124 |
+
with st.expander("Detailed Description"): # Expandable description
|
| 125 |
st.write(aircraft_info["Description"])
|