Phani1008 commited on
Commit
e3eb987
verified
1 Parent(s): 635faf7

Update pages/1_Introduction.py

Browse files

![DALL路E 2024-12-27 18.19.15 - A warm and cozy scene of a father sitting with his 3-year-old child in a living room, showing pictures of dogs and cats. The father is pointing at a p.webp](https://cdn-uploads.huggingface.co/production/uploads/66bc630d79cf011831383ac5/xCFF340XVsqHv4WZvsPMx.webp)

Files changed (1) hide show
  1. pages/1_Introduction.py +17 -4
pages/1_Introduction.py CHANGED
@@ -1,10 +1,23 @@
1
  import streamlit as st
2
  from PIL import Image
3
 
4
- # Load and display the image directly from a relative or absolute file path
5
- # Ensure the image is in the correct folder or update the path accordingly
6
- image_path = r"C:\Users\USER\Downloads\DALL路E 2024-12-27 18.19.15 - A warm and cozy scene of a father sitting with his 3-year-old child in a living room, showing pictures of dogs and cats. The father is pointing at a p.webp" # Correct the path and name
7
- image = Image.open(image_path)
 
 
 
 
 
 
 
 
 
 
 
 
 
8
 
9
  # Title and introduction
10
  st.title('Understanding Machine Learning: Teaching Machines Like Children')
 
1
  import streamlit as st
2
  from PIL import Image
3
 
4
+ import streamlit as st
5
+ from PIL import Image
6
+
7
+ # Simplified path
8
+ image_path = r"C:\Users\USER\Downloads\DALL路E 2024-12-27 18.19.15 - A warm and cozy scene of a father sitting with his 3-year-old child in a living room, showing pictures of dogs and cats. The father is pointing at a p.webp" # Ensure this file is in the same directory or an accessible folder
9
+
10
+ try:
11
+ image = Image.open(image_path)
12
+ st.image(image, caption="A father teaching his child by showing dog and cat pictures", use_column_width=True)
13
+ except FileNotFoundError:
14
+ st.error("Image file not found. Please upload the image or check the file path.")
15
+
16
+ # Optionally: Allow user uploads
17
+ uploaded_file = st.file_uploader("Upload an image", type=["webp", "jpg", "jpeg", "png"])
18
+ if uploaded_file is not None:
19
+ image = Image.open(uploaded_file)
20
+ st.image(image, caption="Uploaded image", use_column_width=True)
21
 
22
  # Title and introduction
23
  st.title('Understanding Machine Learning: Teaching Machines Like Children')