|
import streamlit as st |
|
from datasets import load_dataset |
|
import streamlit.components.v1 as components |
|
|
|
|
|
dataset = load_dataset("awacke1/DatasetOfDatasetsUSA") |
|
|
|
|
|
if 'index' not in st.session_state: |
|
st.session_state.index = 0 |
|
|
|
|
|
max_index = len(dataset['train']) - 1 |
|
|
|
|
|
col1, col2, col3, col4, col5 = st.columns(5) |
|
with col1: |
|
if st.button('⏮️'): |
|
st.session_state.index = 0 |
|
with col2: |
|
if st.button('◀️') and st.session_state.index > 0: |
|
st.session_state.index -= 1 |
|
with col3: |
|
st.write(f"Record {st.session_state.index + 1} of {max_index + 1}") |
|
with col4: |
|
if st.button('▶️') and st.session_state.index < max_index: |
|
st.session_state.index += 1 |
|
with col5: |
|
if st.button('⏭️'): |
|
st.session_state.index = max_index |
|
|
|
|
|
aframe_html = """ |
|
<a-scene embedded style="width: 800px; height: 600px;"> |
|
<a-sky color="#ECECEC"></a-sky> |
|
""" |
|
|
|
|
|
for index, item in enumerate(dataset['train']): |
|
cityOrState = item['cityOrState'] |
|
link = item['link'] |
|
linkType = item['linkType'] |
|
position = f"{index * 1.5} 1.25 -3" |
|
aframe_html += f""" |
|
<a-link href="{link}" position="{position}" title="{cityOrState} - {linkType}" image="#homeThumbnail"></a-link> |
|
""" |
|
|
|
|
|
aframe_html += "</a-scene>" |
|
|
|
|
|
components.html(aframe_html, height=600) |
|
|