Spaces:
Sleeping
Sleeping
File size: 3,436 Bytes
2bab301 a69cbd5 230626d a69cbd5 5c3a07c a69cbd5 5c3a07c 2bab301 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
import streamlit as st
import pandas as pd
import numpy as np
import yfinance as yf
import altair as alt
import plotly.figure_factory as ff
import pydeck as pdk
from vega_datasets import data as vds
import plotly.express as px
import plotly.graph_objects as go
from plotly.subplots import make_subplots
from streamlit_image_comparison import image_comparison
def on_input_change():
user_input = st.session_state.user_input
st.session_state.past.append(user_input)
st.session_state.generated.append(
{"data": "The messages from Bot\nWith new line", "type": "normal"}
)
def on_btn_click():
del st.session_state.past[:]
del st.session_state.generated[:]
def main():
st.title(" US Real Estate Data and Market Trends")
(
col1,
col2,
) = st.columns(2)
with col1:
option = st.selectbox(" Monthly / Weekly", [" Monthly ", " Weekly"])
with col2:
option = st.selectbox(" Current / Historical", [" Current ", " Historical"])
(
col1,
col2,
) = st.columns(2)
with col1:
option = st.selectbox(" Median / Mean", [" Median ", " Mean"])
with col2:
option = st.selectbox(" San Francisco", [" San Francisco"])
(
col1,
col2,
) = st.columns(2)
with col1:
selected_color = st.color_picker(" Choose a palate", "#FF0000")
with col2:
value = st.slider(" No of colors", min_value=0, max_value=100, value=50, key=70)
if st.checkbox(" Show raw data"):
st.write("Checkbox checked!")
st.subheader(" Global 3D Visualization")
st.pydeck_chart(
pdk.Deck(
map_style=None,
initial_view_state=pdk.ViewState(
latitude=37.76, longitude=-122.4, zoom=11, pitch=50
),
layers=[
pdk.Layer(
"HexagonLayer",
data=pd.DataFrame(
np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],
columns=["lat", "lon"],
),
get_position="[lon, lat]",
radius=200,
elevation_scale=4,
elevation_range=[0, 1000],
pickable=True,
extruded=True,
),
pdk.Layer(
"ScatterplotLayer",
data=pd.DataFrame(
np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],
columns=["lat", "lon"],
),
get_position="[lon, lat]",
get_color="[200, 30, 0, 160]",
get_radius=200,
),
],
)
)
st.subheader(" 2D Visualization")
st.altair_chart(
alt.Chart(
pd.DataFrame(
{
"x": np.random.rand(50),
"y": np.random.rand(50),
"size": np.random.randint(10, 100, 50),
"color": np.random.rand(50),
}
)
)
.mark_circle()
.encode(
x="x",
y="y",
size="size",
color="color",
tooltip=["x", "y", "size", "color"],
)
.properties(width=600, height=400),
use_container_width=True,
)
if __name__ == "__main__":
main()
|