awacke1 commited on
Commit
b9e24c0
ยท
verified ยท
1 Parent(s): 04f0edb

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +19 -17
app.py CHANGED
@@ -29,22 +29,24 @@ with col5:
29
  if st.button('โญ๏ธ'):
30
  st.session_state.index = max_index
31
 
32
- # Assuming the dataset has the columns 'cityOrState', 'link', and 'linkType'
33
- item = dataset['train'][st.session_state.index]
34
- cityOrState = item['cityOrState']
35
- link = item['link']
36
- linkType = item['linkType']
37
-
38
- # Build the HTML for the current record
39
- links_html = f"""
40
- <ul style="list-style: none; padding: 0;">
41
- <li style="margin: 10px 0; padding: 10px; background-color: #f0f0f0; border-radius: 8px; box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);">
42
- <a href="{link}" target="_blank" style="text-decoration: none; color: #333;">
43
- <strong>{cityOrState}</strong> - {linkType} ๐Ÿ”—
44
- </a>
45
- </li>
46
- </ul>
47
  """
48
 
49
- # Use Streamlit components to render the HTML
50
- components.html(links_html, height=100)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
29
  if st.button('โญ๏ธ'):
30
  st.session_state.index = max_index
31
 
32
+ # Generate the A-Frame scene HTML with links from the dataset
33
+ aframe_html = """
34
+ <a-scene embedded style="width: 800px; height: 600px;">
35
+ <a-sky color="#ECECEC"></a-sky>
 
 
 
 
 
 
 
 
 
 
 
36
  """
37
 
38
+ # Loop through the dataset and create a-link entities for each record
39
+ for index, item in enumerate(dataset['train']):
40
+ cityOrState = item['cityOrState']
41
+ link = item['link']
42
+ linkType = item['linkType']
43
+ position = f"{index * 1.5} 1.25 -3" # Simple positioning logic
44
+ aframe_html += f"""
45
+ <a-link href="{link}" position="{position}" title="{cityOrState} - {linkType}" image="#homeThumbnail"></a-link>
46
+ """
47
+
48
+ # Close the A-Scene tag
49
+ aframe_html += "</a-scene>"
50
+
51
+ # Use Streamlit components to render the A-Frame HTML
52
+ components.html(aframe_html, height=600)