Phani1008 commited on
Commit
7b3f334
·
verified ·
1 Parent(s): f297077

Update pages/1_Introduction.py

Browse files

![WhatsApp Image 2024-12-28 at 14.09.31.jpeg](https://cdn-uploads.huggingface.co/production/uploads/66bc630d79cf011831383ac5/8-pXgMhGxCtkuOMR7qCR3.jpeg)

Files changed (1) hide show
  1. pages/1_Introduction.py +2 -22
pages/1_Introduction.py CHANGED
@@ -4,26 +4,7 @@ import base64
4
  import io
5
 
6
  # Base64 encoded image string (ensure the base64 string is complete)
7
- encoded_image = "UklGRrICBgBXRUJQVlA4IKrbBABQ9xCdASoABwAEPjEWiUOiISUmJZYbuMAGCWNsiXpgHwljA+sbSoKb/m/ZfJS/8fokeQ9+Mnxx"
8
 
9
- # Decode Base64 string to image and convert to PNG format (if necessary)
10
- def decode_base64_image(encoded_str):
11
- try:
12
- # Decode the base64 string
13
- img_data = base64.b64decode(encoded_str)
14
- # Create a BytesIO object from the image data
15
- img = Image.open(io.BytesIO(img_data))
16
-
17
- # If the image is in a WebP format or any other format that PIL struggles with, convert to PNG
18
- if img.format not in ['PNG', 'JPEG']:
19
- img = img.convert("RGB") # Convert to RGB if it's not already
20
- img = img.convert("P") # Convert to PNG if necessary
21
-
22
- return img
23
- except Exception as e:
24
- # Handle any errors during decoding and show error message
25
- st.error(f"Error decoding image: {e}")
26
- return None
27
 
28
  # Title and introduction
29
  st.title('Understanding Machine Learning: Teaching Machines Like Children')
@@ -35,9 +16,8 @@ In this app, we'll use the analogy of a father teaching his child to explain the
35
  """)
36
 
37
  # Display the image
38
- image = decode_base64_image(encoded_image)
39
- if image:
40
- st.image(image, caption='A father teaching his child by showing dog and cat pictures')
41
 
42
  # Supervised Learning Explanation
43
  st.header('Supervised Learning')
 
4
  import io
5
 
6
  # Base64 encoded image string (ensure the base64 string is complete)
 
7
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  # Title and introduction
10
  st.title('Understanding Machine Learning: Teaching Machines Like Children')
 
16
  """)
17
 
18
  # Display the image
19
+
20
+ st.image(r"C:\Users\USER\Downloads\WhatsApp Image 2024-12-28 at 14.09.31.jpeg", caption='A father teaching his child by showing dog and cat pictures')
 
21
 
22
  # Supervised Learning Explanation
23
  st.header('Supervised Learning')