Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -29,22 +29,24 @@ with col5:
|
|
| 29 |
if st.button('βοΈ'):
|
| 30 |
st.session_state.index = max_index
|
| 31 |
|
| 32 |
-
#
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 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 |
-
#
|
| 50 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 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)
|