Spaces:
Sleeping
Sleeping
Commit
·
90f3345
1
Parent(s):
8247e44
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -26,80 +26,34 @@ def on_btn_click():
|
|
26 |
|
27 |
|
28 |
def main():
|
29 |
-
st.title("
|
30 |
(
|
31 |
col1,
|
32 |
col2,
|
33 |
) = st.columns(2)
|
34 |
with col1:
|
35 |
-
st.
|
36 |
-
pd.DataFrame(
|
37 |
-
{
|
38 |
-
"Apple": yf.download("AAPL", start="2023-01-01", end="2023-07-31")[
|
39 |
-
"Adj Close"
|
40 |
-
],
|
41 |
-
"Google": yf.download(
|
42 |
-
"GOOGL", start="2023-01-01", end="2023-07-31"
|
43 |
-
)["Adj Close"],
|
44 |
-
"Microsoft": yf.download(
|
45 |
-
"MSFT", start="2023-01-01", end="2023-07-31"
|
46 |
-
)["Adj Close"],
|
47 |
-
}
|
48 |
-
)
|
49 |
-
)
|
50 |
with col2:
|
51 |
-
|
52 |
-
|
53 |
-
|
54 |
-
|
55 |
-
st.
|
56 |
-
|
57 |
-
|
58 |
-
|
59 |
-
|
60 |
-
|
61 |
-
|
62 |
-
|
63 |
-
|
64 |
-
|
65 |
-
"
|
66 |
-
|
67 |
-
|
68 |
-
|
69 |
-
|
70 |
-
|
71 |
-
},
|
72 |
-
}
|
73 |
-
tab1, tab2 = st.tabs(["Streamlit theme (default)", "Vega-Lite native theme"])
|
74 |
-
with tab1:
|
75 |
-
st.vega_lite_chart(source, chart, theme="streamlit", use_container_width=True)
|
76 |
-
with tab2:
|
77 |
-
st.vega_lite_chart(source, chart, theme=None, use_container_width=True)
|
78 |
-
st.altair_chart(
|
79 |
-
alt.Chart(
|
80 |
-
pd.DataFrame(
|
81 |
-
{
|
82 |
-
"x": np.random.rand(50),
|
83 |
-
"y": np.random.rand(50),
|
84 |
-
"size": np.random.randint(10, 100, 50),
|
85 |
-
"color": np.random.rand(50),
|
86 |
-
}
|
87 |
-
)
|
88 |
-
)
|
89 |
-
.mark_circle()
|
90 |
-
.encode(
|
91 |
-
x="x",
|
92 |
-
y="y",
|
93 |
-
size="size",
|
94 |
-
color="color",
|
95 |
-
tooltip=["x", "y", "size", "color"],
|
96 |
-
)
|
97 |
-
.properties(width=600, height=400),
|
98 |
-
use_container_width=True,
|
99 |
-
)
|
100 |
-
st.bar_chart(
|
101 |
-
pd.DataFrame(np.random.randn(20, 3), columns=["Apple", "Banana", "Cherry"])
|
102 |
-
)
|
103 |
st.pydeck_chart(
|
104 |
pdk.Deck(
|
105 |
map_style=None,
|
@@ -133,52 +87,29 @@ def main():
|
|
133 |
],
|
134 |
)
|
135 |
)
|
136 |
-
|
137 |
-
|
138 |
-
|
139 |
-
|
140 |
-
|
141 |
-
|
142 |
-
|
143 |
-
|
144 |
-
|
145 |
-
|
146 |
-
(
|
147 |
-
col1,
|
148 |
-
col2,
|
149 |
-
) = st.columns(2)
|
150 |
-
with col1:
|
151 |
-
df = px.data.gapminder().query("year == 2007").query("continent == 'Americas'")
|
152 |
-
fig = px.pie(
|
153 |
-
df,
|
154 |
-
values="pop",
|
155 |
-
names="country",
|
156 |
-
title="Population of American continent",
|
157 |
-
hover_data=["lifeExp"],
|
158 |
-
labels={"lifeExp": "life expectancy"},
|
159 |
-
)
|
160 |
-
fig.update_traces(textposition="inside", textinfo="percent+label")
|
161 |
-
st.plotly_chart(fig)
|
162 |
-
with col2:
|
163 |
-
fig = go.Figure(
|
164 |
-
go.Sunburst(
|
165 |
-
labels=[
|
166 |
-
"Eve",
|
167 |
-
"Cain",
|
168 |
-
"Seth",
|
169 |
-
"Enos",
|
170 |
-
"Noam",
|
171 |
-
"Abel",
|
172 |
-
"Awan",
|
173 |
-
"Enoch",
|
174 |
-
"Azura",
|
175 |
-
],
|
176 |
-
parents=["", "Eve", "Eve", "Seth", "Seth", "Eve", "Eve", "Awan", "Eve"],
|
177 |
-
values=[10, 14, 12, 10, 2, 6, 6, 4, 4],
|
178 |
)
|
179 |
)
|
180 |
-
|
181 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
182 |
|
183 |
|
184 |
if __name__ == "__main__":
|
|
|
26 |
|
27 |
|
28 |
def main():
|
29 |
+
st.title(" US Real Estate Data and Market Trends")
|
30 |
(
|
31 |
col1,
|
32 |
col2,
|
33 |
) = st.columns(2)
|
34 |
with col1:
|
35 |
+
option = st.selectbox(" Monthly / Weekly", [" Monthly ", " Weekly"])
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
36 |
with col2:
|
37 |
+
option = st.selectbox(" Current / Historical", [" Current ", " Historical"])
|
38 |
+
(
|
39 |
+
col1,
|
40 |
+
col2,
|
41 |
+
) = st.columns(2)
|
42 |
+
with col1:
|
43 |
+
option = st.selectbox(" Median / Mean", [" Median ", " Mean"])
|
44 |
+
with col2:
|
45 |
+
option = st.selectbox(" San Francisco", [" San Francisco"])
|
46 |
+
(
|
47 |
+
col1,
|
48 |
+
col2,
|
49 |
+
) = st.columns(2)
|
50 |
+
with col1:
|
51 |
+
selected_color = st.color_picker(" Choose a palate", "#FF0000")
|
52 |
+
with col2:
|
53 |
+
value = st.slider(" No of colors", min_value=0, max_value=100, value=50, key=48)
|
54 |
+
if st.checkbox(" Show raw data"):
|
55 |
+
st.write("Checkbox checked!")
|
56 |
+
st.subheader(" Global 3D Visualization")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
57 |
st.pydeck_chart(
|
58 |
pdk.Deck(
|
59 |
map_style=None,
|
|
|
87 |
],
|
88 |
)
|
89 |
)
|
90 |
+
st.subheader(" 2D Visualization")
|
91 |
+
st.altair_chart(
|
92 |
+
alt.Chart(
|
93 |
+
pd.DataFrame(
|
94 |
+
{
|
95 |
+
"x": np.random.rand(50),
|
96 |
+
"y": np.random.rand(50),
|
97 |
+
"size": np.random.randint(10, 100, 50),
|
98 |
+
"color": np.random.rand(50),
|
99 |
+
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
)
|
101 |
)
|
102 |
+
.mark_circle()
|
103 |
+
.encode(
|
104 |
+
x="x",
|
105 |
+
y="y",
|
106 |
+
size="size",
|
107 |
+
color="color",
|
108 |
+
tooltip=["x", "y", "size", "color"],
|
109 |
+
)
|
110 |
+
.properties(width=600, height=400),
|
111 |
+
use_container_width=True,
|
112 |
+
)
|
113 |
|
114 |
|
115 |
if __name__ == "__main__":
|