Spaces:
Build error
Build error
Update app.py
Browse files
app.py
CHANGED
|
@@ -1,6 +1,6 @@
|
|
| 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 |
|
|
@@ -20,35 +20,27 @@ if selected_aircraft:
|
|
| 20 |
|
| 21 |
st.subheader(aircraft_info["Aircraft Name"])
|
| 22 |
|
| 23 |
-
#
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
st.image(
|
| 28 |
-
|
| 29 |
-
|
|
|
|
|
|
|
|
|
|
| 30 |
|
| 31 |
|
| 32 |
col1, col2 = st.columns(2)
|
| 33 |
|
| 34 |
with col1:
|
| 35 |
-
|
| 36 |
-
st.write(f"**Manufacturer:** {aircraft_info['Manufacturer']}")
|
| 37 |
-
st.write(f"**First Flight:** {aircraft_info['First Flight']}")
|
| 38 |
-
st.write(f"**Introduction:** {aircraft_info['Introduction']}")
|
| 39 |
st.write(f"**Role:** {aircraft_info['Role']}")
|
| 40 |
|
| 41 |
with col2:
|
| 42 |
-
|
| 43 |
-
st.write(f"**
|
| 44 |
-
st.write(f"**Capacity:** {aircraft_info['Capacity']}")
|
| 45 |
-
st.write(f"**Length:** {aircraft_info['Length (m)']} m") # Added units
|
| 46 |
-
st.write(f"**Wingspan:** {aircraft_info['Wingspan (m)']} m") # Added units
|
| 47 |
-
st.write(f"**Height:** {aircraft_info['Height (m)']} m") # Added units
|
| 48 |
-
st.write(f"**Max Speed:** {aircraft_info['Max Speed (km/h)']} km/h") # Added units
|
| 49 |
-
st.write(f"**Range:** {aircraft_info['Range (km)']} km") # Added units
|
| 50 |
-
st.write(f"**Service Ceiling:** {aircraft_info['Service Ceiling (m)']} m") # Added units
|
| 51 |
-
|
| 52 |
|
| 53 |
with st.expander("Detailed Description"):
|
| 54 |
st.write(aircraft_info["Description"])
|
|
|
|
|
|
|
| 1 |
import streamlit as st
|
| 2 |
import pandas as pd
|
| 3 |
+
import os
|
| 4 |
|
| 5 |
st.set_page_config(page_title="Aircraft Information App", page_icon=":airplane:", layout="wide")
|
| 6 |
|
|
|
|
| 20 |
|
| 21 |
st.subheader(aircraft_info["Aircraft Name"])
|
| 22 |
|
| 23 |
+
# Improved Image Display Handling (Robust for Hugging Face and Local)
|
| 24 |
+
image_path = aircraft_info["Image URL"] # Get the path from the CSV
|
| 25 |
+
|
| 26 |
+
if os.path.exists(image_path): # Check if it's a local file
|
| 27 |
+
st.image(image_path, use_column_width=True, caption=aircraft_info["Aircraft Name"])
|
| 28 |
+
else: # Treat as a URL
|
| 29 |
+
try:
|
| 30 |
+
st.image(image_path, use_column_width=True, caption=aircraft_info["Aircraft Name"])
|
| 31 |
+
except Exception as e:
|
| 32 |
+
st.error(f"Error displaying image: {e}. Please check the URL or file path in the CSV.")
|
| 33 |
|
| 34 |
|
| 35 |
col1, col2 = st.columns(2)
|
| 36 |
|
| 37 |
with col1:
|
| 38 |
+
# ... (rest of the code - same as before)
|
|
|
|
|
|
|
|
|
|
| 39 |
st.write(f"**Role:** {aircraft_info['Role']}")
|
| 40 |
|
| 41 |
with col2:
|
| 42 |
+
# ... (rest of the code - same as before)
|
| 43 |
+
st.write(f"**Service Ceiling:** {aircraft_info['Service Ceiling (m)']} m")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 44 |
|
| 45 |
with st.expander("Detailed Description"):
|
| 46 |
st.write(aircraft_info["Description"])
|