Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -2,66 +2,92 @@ import streamlit as st
|
|
| 2 |
import pandas as pd
|
| 3 |
import os
|
| 4 |
|
| 5 |
-
st.set_page_config(page_title="
|
| 6 |
|
| 7 |
-
# Create a DataFrame for the F-16
|
| 8 |
-
|
| 9 |
-
"
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
| 20 |
-
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 26 |
}
|
| 27 |
-
aircraft_info = pd.DataFrame([f16_data]).iloc[0] # Convert the dictionary to match the previous code
|
| 28 |
|
| 29 |
-
st.title("
|
| 30 |
|
| 31 |
-
|
|
|
|
| 32 |
|
| 33 |
-
|
|
|
|
| 34 |
|
| 35 |
-
|
| 36 |
-
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
|
|
|
|
| 40 |
st.image(image_path, use_column_width=True, caption=aircraft_info["Aircraft Name"])
|
| 41 |
-
|
| 42 |
-
|
| 43 |
-
|
| 44 |
-
|
|
|
|
|
|
|
|
|
|
| 45 |
|
| 46 |
-
col1, col2 = st.columns(2)
|
| 47 |
|
| 48 |
-
with col1:
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
|
| 55 |
-
with col2:
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
|
| 66 |
-
with st.expander("Detailed Description"):
|
| 67 |
-
|
|
|
|
| 2 |
import pandas as pd
|
| 3 |
import os
|
| 4 |
|
| 5 |
+
st.set_page_config(page_title="Fighters Information", page_icon=":airplane:", layout="wide")
|
| 6 |
|
| 7 |
+
# Create a DataFrame for the F-16 and F-15
|
| 8 |
+
aircraft_data = {
|
| 9 |
+
"F-16": {
|
| 10 |
+
"Aircraft Name": "General Dynamics F-16 Fighting Falcon",
|
| 11 |
+
"Image URL": "f16.jpg", # Replace with the actual filename (for Hugging Face) or URL
|
| 12 |
+
"Origin": "United States",
|
| 13 |
+
"Manufacturer": "General Dynamics",
|
| 14 |
+
"First Flight": 1974,
|
| 15 |
+
"Introduction": 1979,
|
| 16 |
+
"Role": "Multirole fighter",
|
| 17 |
+
"Variants": "F-16A, F-16B, F-16C, F-16D",
|
| 18 |
+
"Crew": 1,
|
| 19 |
+
"Capacity": "N/A",
|
| 20 |
+
"Length (m)": 15.03,
|
| 21 |
+
"Wingspan (m)": 9.96,
|
| 22 |
+
"Height (m)": 5.09,
|
| 23 |
+
"Max Speed (km/h)": 2414,
|
| 24 |
+
"Range (km)": 3400,
|
| 25 |
+
"Service Ceiling (m)": 15240,
|
| 26 |
+
"Description": "The General Dynamics F-16 Fighting Falcon is a multirole fighter aircraft originally developed by General Dynamics for the United States Air Force. It is a highly versatile aircraft and has been exported to many countries."
|
| 27 |
+
},
|
| 28 |
+
"F-15": {
|
| 29 |
+
"Aircraft Name": "McDonnell Douglas F-15 Eagle",
|
| 30 |
+
"Image URL": "f15.jpg", # Replace with the actual filename (for Hugging Face) or URL
|
| 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,
|
| 41 |
+
"Height (m)": 5.63,
|
| 42 |
+
"Max Speed (km/h)": 3000+,
|
| 43 |
+
"Range (km)": 4445,
|
| 44 |
+
"Service Ceiling (m)": 18000+,
|
| 45 |
+
"Description": "The McDonnell Douglas F-15 Eagle is an American twin-engine, all-weather tactical fighter aircraft designed by McDonnell Douglas. It is among the most successful modern fighters, with over 100 victories in air-to-air combat without a loss."
|
| 46 |
+
}
|
| 47 |
}
|
|
|
|
| 48 |
|
| 49 |
+
st.title("Fighter Information")
|
| 50 |
|
| 51 |
+
aircraft_names = list(aircraft_data.keys()) # Get the names of the aircraft
|
| 52 |
+
selected_aircraft = st.selectbox("Select an Aircraft", aircraft_names)
|
| 53 |
|
| 54 |
+
if selected_aircraft:
|
| 55 |
+
aircraft_info = pd.DataFrame([aircraft_data[selected_aircraft]]).iloc[0] # Select data for the chosen aircraft
|
| 56 |
|
| 57 |
+
st.subheader(aircraft_info["Aircraft Name"])
|
| 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 |
+
try:
|
| 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 for this aircraft.")
|
| 71 |
|
| 72 |
+
col1, col2 = st.columns(2)
|
| 73 |
|
| 74 |
+
with col1:
|
| 75 |
+
st.write(f"**Origin:** {aircraft_info['Origin']}")
|
| 76 |
+
st.write(f"**Manufacturer:** {aircraft_info['Manufacturer']}")
|
| 77 |
+
st.write(f"**First Flight:** {aircraft_info['First Flight']}")
|
| 78 |
+
st.write(f"**Introduction:** {aircraft_info['Introduction']}")
|
| 79 |
+
st.write(f"**Role:** {aircraft_info['Role']}")
|
| 80 |
|
| 81 |
+
with col2:
|
| 82 |
+
st.write(f"**Variants:** {aircraft_info['Variants']}")
|
| 83 |
+
st.write(f"**Crew:** {aircraft_info['Crew']}")
|
| 84 |
+
st.write(f"**Capacity:** {aircraft_info['Capacity']}")
|
| 85 |
+
st.write(f"**Length:** {aircraft_info['Length (m)']} m")
|
| 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"])
|