Phani1008 commited on
Commit
677e1e3
·
verified ·
1 Parent(s): 0052408

Update pages/1_Introduction.py

Browse files
Files changed (1) hide show
  1. pages/1_Introduction.py +8 -5
pages/1_Introduction.py CHANGED
@@ -1,13 +1,15 @@
1
  import streamlit as st
2
  from PIL import Image
3
  import base64
 
4
 
5
  # Base64 encoded image string
6
  encoded_image = "UklGRrICBgBXRUJQVlA4IKrbBABQ9xCdASoABwAEPjEWiUOiISUmJZYbuMAGCWNsiXpgHwljA+sbSoKb/m/ZfJS/8fokeQ9+Mnxx"
7
 
8
- # Decode and display the image
9
- def get_base64_img(encoded_str):
10
- return f"data:image/png;base64,{encoded_str}"
 
11
 
12
  # Title and introduction
13
  st.title('Understanding Machine Learning: Teaching Machines Like Children')
@@ -18,8 +20,9 @@ Machine Learning (ML) is like teaching a child to recognize things by showing ex
18
  In this app, we'll use the analogy of a father teaching his child to explain these key ML concepts.
19
  """)
20
 
21
- # Display the embedded image
22
- st.image(get_base64_img(encoded_image), caption='A father teaching his child by showing dog and cat pictures')
 
23
 
24
  # Supervised Learning Explanation
25
  st.header('Supervised Learning')
 
1
  import streamlit as st
2
  from PIL import Image
3
  import base64
4
+ import io
5
 
6
  # Base64 encoded image string
7
  encoded_image = "UklGRrICBgBXRUJQVlA4IKrbBABQ9xCdASoABwAEPjEWiUOiISUmJZYbuMAGCWNsiXpgHwljA+sbSoKb/m/ZfJS/8fokeQ9+Mnxx"
8
 
9
+ # Decode Base64 string to image
10
+ def decode_base64_image(encoded_str):
11
+ img_data = base64.b64decode(encoded_str)
12
+ return Image.open(io.BytesIO(img_data))
13
 
14
  # Title and introduction
15
  st.title('Understanding Machine Learning: Teaching Machines Like Children')
 
20
  In this app, we'll use the analogy of a father teaching his child to explain these key ML concepts.
21
  """)
22
 
23
+ # Display the image
24
+ image = decode_base64_image(encoded_image)
25
+ st.image(image, caption='A father teaching his child by showing dog and cat pictures')
26
 
27
  # Supervised Learning Explanation
28
  st.header('Supervised Learning')