Spaces:
Sleeping
Sleeping
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() | |