Spaces:
Sleeping
Sleeping
Update pages/1_Introduction.py
Browse files- pages/1_Introduction.py +28 -44
pages/1_Introduction.py
CHANGED
|
@@ -1,46 +1,30 @@
|
|
| 1 |
import streamlit as st
|
| 2 |
from PIL import Image
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
st.
|
| 18 |
-
|
| 19 |
-
#
|
| 20 |
-
st.
|
| 21 |
-
|
| 22 |
-
|
| 23 |
-
|
| 24 |
-
|
| 25 |
-
|
| 26 |
-
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
# Unsupervised Learning Explanation
|
| 32 |
-
st.header('Unsupervised Learning')
|
| 33 |
-
st.write("""
|
| 34 |
-
In unsupervised learning, the machine is not given explicit labels. It tries to identify patterns and groupings on its own. This is like the child noticing differences between animals without being told their names.
|
| 35 |
-
|
| 36 |
-
**Analogy:**
|
| 37 |
-
- X_i: A set of pictures of animals (without labels)
|
| 38 |
-
- Y_i: The child starts grouping pictures into categories like 'dogs', 'cats', etc., even if they don't know the exact names.
|
| 39 |
-
|
| 40 |
-
Unsupervised learning helps the machine find structure in data without needing labeled examples.
|
| 41 |
-
""")
|
| 42 |
-
|
| 43 |
-
# Conclusion
|
| 44 |
-
st.write("""
|
| 45 |
-
Machine Learning mirrors how humans, especially children, learn by observing and being guided. This analogy helps simplify the complex concepts behind teaching machines to recognize patterns and make decisions. Just like the child learns over time, machines improve as they are exposed to more data.
|
| 46 |
-
""")
|
|
|
|
| 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.")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|