Spaces:
Sleeping
Sleeping
Update pages/1_Introduction.py
Browse files
- pages/1_Introduction.py +0 -30
pages/1_Introduction.py
CHANGED
|
@@ -1,30 +0,0 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
from PIL import Image
|
| 3 |
-
import os
|
| 4 |
-
|
| 5 |
-
# Define the file path
|
| 6 |
-
image_path = r"C:\Users\USER\Downloads\Screenshot 2024-12-27 183457.png"# Replace with your actual file name and location
|
| 7 |
-
|
| 8 |
-
# Try loading the image from the file path
|
| 9 |
-
image = None
|
| 10 |
-
if os.path.exists(image_path):
|
| 11 |
-
try:
|
| 12 |
-
image = Image.open(image_path)
|
| 13 |
-
st.image(image, caption="A father teaching his child by showing dog and cat pictures", use_column_width=True)
|
| 14 |
-
except Exception as e:
|
| 15 |
-
st.error(f"Error loading the image: {e}")
|
| 16 |
-
else:
|
| 17 |
-
st.warning("Default image not found. Please upload an image.")
|
| 18 |
-
|
| 19 |
-
# Allow the user to upload an image if the default is unavailable or they want a custom image
|
| 20 |
-
uploaded_file = st.file_uploader("Upload an image", type=["webp", "jpg", "jpeg", "png"])
|
| 21 |
-
if uploaded_file is not None:
|
| 22 |
-
try:
|
| 23 |
-
image = Image.open(uploaded_file)
|
| 24 |
-
st.image(image, caption="Uploaded image", use_column_width=True)
|
| 25 |
-
except Exception as e:
|
| 26 |
-
st.error(f"Error loading the uploaded image: {e}")
|
| 27 |
-
|
| 28 |
-
# Ensure there's no further reference to 'image' if it isn't defined
|
| 29 |
-
if image is None:
|
| 30 |
-
st.error("No image available. Please check the file path or upload an image.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|