eaglelandsonce commited on
Commit
a304d5f
·
verified ·
1 Parent(s): 441f892

Update pages/03_Talk_to_the_Greats.py

Browse files
Files changed (1) hide show
  1. pages/03_Talk_to_the_Greats.py +29 -6
pages/03_Talk_to_the_Greats.py CHANGED
@@ -10,7 +10,7 @@ def image_to_base64(image_path):
10
  # Page Title
11
  st.title("Talk with the Great Physicist")
12
 
13
- # Image paths and URLs
14
  images = [
15
  ("Einstein", "images/image01.png", "https://chatgpt.com/g/g-ocQnGKXGx-einstein-learn-relativity"),
16
  ("Dirac", "images/image02.png", "https://chatgpt.com/g/g-JjKhIfBft-dirac-learn-quantum-mechanics"),
@@ -21,12 +21,35 @@ images = [
21
  ]
22
 
23
  # Function to create clickable images with hover effect
24
- def clickable_image_with_name(image_name, image_path, link):
25
  # Convert image to base64 for embedding
26
  img_base64 = image_to_base64(image_path)
27
 
28
  # HTML with hover effect and link
29
- html_code = f'''
30
- <div style="text-align:center;">
31
- <a href="{link}" target="_blank">
32
- <img src="data:image/png;base64,{img_base64}" alt
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
10
  # Page Title
11
  st.title("Talk with the Great Physicist")
12
 
13
+ # Image paths
14
  images = [
15
  ("Einstein", "images/image01.png", "https://chatgpt.com/g/g-ocQnGKXGx-einstein-learn-relativity"),
16
  ("Dirac", "images/image02.png", "https://chatgpt.com/g/g-JjKhIfBft-dirac-learn-quantum-mechanics"),
 
21
  ]
22
 
23
  # Function to create clickable images with hover effect
24
+ def clickable_image(image_name, image_path, link):
25
  # Convert image to base64 for embedding
26
  img_base64 = image_to_base64(image_path)
27
 
28
  # HTML with hover effect and link
29
+ html_code = f"""
30
+ <a href="{link}" target="_blank">
31
+ <img src="data:image/png;base64,{img_base64}" alt="{image_name}"
32
+ style="border: 2px solid transparent; border-radius: 10px; width: 100%;"
33
+ onmouseover="this.style.borderColor='#007BFF';"
34
+ onmouseout="this.style.borderColor='transparent';">
35
+ </a>
36
+ """
37
+ st.markdown(html_code, unsafe_allow_html=True)
38
+
39
+ # Create three columns for the images
40
+ col1, col2, col3 = st.columns(3)
41
+
42
+ # First column (Einstein and Maxwell)
43
+ with col1:
44
+ clickable_image(*images[0]) # Einstein
45
+ clickable_image(*images[3]) # Maxwell
46
+
47
+ # Second column (Dirac and Newton)
48
+ with col2:
49
+ clickable_image(*images[1]) # Dirac
50
+ clickable_image(*images[4]) # Newton
51
+
52
+ # Third column (Feynman and Chat with All)
53
+ with col3:
54
+ clickable_image(*images[2]) # Feynman
55
+ clickable_image(*images[5]) # Chat with All