Spaces:
Sleeping
Sleeping
Commit
·
a1fcc21
1
Parent(s):
54a9b1e
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -26,85 +26,42 @@ def on_btn_click():
|
|
26 |
|
27 |
|
28 |
def main():
|
29 |
-
st.
|
|
|
|
|
30 |
(
|
31 |
col1,
|
32 |
col2,
|
33 |
) = st.columns(2)
|
34 |
with col1:
|
35 |
-
|
36 |
with col2:
|
37 |
-
option = st.selectbox(
|
38 |
-
|
39 |
-
|
40 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
41 |
st.write("Button clicked!")
|
42 |
-
st.subheader(" Global Data")
|
43 |
-
df = pd.read_csv(
|
44 |
-
"https://raw.githubusercontent.com/plotly/datasets/master/volcano_db.csv",
|
45 |
-
encoding="iso-8859-1",
|
46 |
-
)
|
47 |
-
freq = df
|
48 |
-
freq = freq.Country.value_counts().reset_index().rename(columns={"count": "x"})
|
49 |
-
df_v = pd.read_csv(
|
50 |
-
"https://raw.githubusercontent.com/plotly/datasets/master/volcano.csv"
|
51 |
-
)
|
52 |
-
fig = make_subplots(
|
53 |
-
rows=2,
|
54 |
-
cols=2,
|
55 |
-
column_widths=[0.6, 0.4],
|
56 |
-
row_heights=[0.4, 0.6],
|
57 |
-
specs=[
|
58 |
-
[{"type": "scattergeo", "rowspan": 2}, {"type": "bar"}],
|
59 |
-
[None, {"type": "surface"}],
|
60 |
-
],
|
61 |
-
)
|
62 |
-
fig.add_trace(
|
63 |
-
go.Scattergeo(
|
64 |
-
lat=df["Latitude"],
|
65 |
-
lon=df["Longitude"],
|
66 |
-
mode="markers",
|
67 |
-
hoverinfo="text",
|
68 |
-
showlegend=False,
|
69 |
-
marker=dict(color="crimson", size=4, opacity=0.8),
|
70 |
-
),
|
71 |
-
row=1,
|
72 |
-
col=1,
|
73 |
-
)
|
74 |
-
fig.add_trace(
|
75 |
-
go.Bar(
|
76 |
-
x=freq["x"][0:10],
|
77 |
-
y=freq["Country"][0:10],
|
78 |
-
marker=dict(color="crimson"),
|
79 |
-
showlegend=False,
|
80 |
-
),
|
81 |
-
row=1,
|
82 |
-
col=2,
|
83 |
-
)
|
84 |
-
fig.add_trace(go.Surface(z=df_v.values.tolist(), showscale=False), row=2, col=2)
|
85 |
-
fig.update_geos(
|
86 |
-
projection_type="orthographic",
|
87 |
-
landcolor="white",
|
88 |
-
oceancolor="MidnightBlue",
|
89 |
-
showocean=True,
|
90 |
-
lakecolor="LightBlue",
|
91 |
-
)
|
92 |
-
fig.update_xaxes(tickangle=45)
|
93 |
-
fig.update_layout(
|
94 |
-
template="plotly_dark",
|
95 |
-
margin=dict(r=10, t=25, b=40, l=60),
|
96 |
-
annotations=[
|
97 |
-
dict(
|
98 |
-
text="Source: NOAA",
|
99 |
-
showarrow=False,
|
100 |
-
xref="paper",
|
101 |
-
yref="paper",
|
102 |
-
x=0,
|
103 |
-
y=0,
|
104 |
-
)
|
105 |
-
],
|
106 |
-
)
|
107 |
-
st.plotly_chart(fig)
|
108 |
(
|
109 |
col1,
|
110 |
col2,
|
@@ -117,6 +74,41 @@ def main():
|
|
117 |
"GDP (trillion USD)": [22.675, 1.843, 2.855, 1.488],
|
118 |
}
|
119 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
120 |
with col2:
|
121 |
df = px.data.gapminder().query("year == 2007").query("continent == 'Americas'")
|
122 |
fig = px.pie(
|
@@ -129,6 +121,41 @@ def main():
|
|
129 |
)
|
130 |
fig.update_traces(textposition="inside", textinfo="percent+label")
|
131 |
st.plotly_chart(fig)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
132 |
|
133 |
|
134 |
if __name__ == "__main__":
|
|
|
26 |
|
27 |
|
28 |
def main():
|
29 |
+
st.write("Hello, world!")
|
30 |
+
st.header(" Al Generated this app - spotify recommendations")
|
31 |
+
st.subheader(" this application contains the auto generated layout")
|
32 |
(
|
33 |
col1,
|
34 |
col2,
|
35 |
) = st.columns(2)
|
36 |
with col1:
|
37 |
+
st.write("Hello, world!")
|
38 |
with col2:
|
39 |
+
option = st.selectbox(
|
40 |
+
" gender / male / female", [" gender ", " male ", " female"]
|
41 |
+
)
|
42 |
+
(
|
43 |
+
col1,
|
44 |
+
col2,
|
45 |
+
) = st.columns(2)
|
46 |
+
with col1:
|
47 |
+
value = st.slider(
|
48 |
+
" max predictions", min_value=0, max_value=100, value=50, key=39
|
49 |
+
)
|
50 |
+
with col2:
|
51 |
+
value = st.slider(
|
52 |
+
" num categories", min_value=0, max_value=100, value=50, key=81
|
53 |
+
)
|
54 |
+
(
|
55 |
+
col1,
|
56 |
+
col2,
|
57 |
+
) = st.columns(2)
|
58 |
+
with col1:
|
59 |
+
option = st.radio("Choose an option:", ["Option 1", "Option 2", "Option 3"])
|
60 |
+
with col2:
|
61 |
+
if st.checkbox("Check me"):
|
62 |
+
st.write("Checkbox checked!")
|
63 |
+
if st.button(" generate recommendations"):
|
64 |
st.write("Button clicked!")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
65 |
(
|
66 |
col1,
|
67 |
col2,
|
|
|
74 |
"GDP (trillion USD)": [22.675, 1.843, 2.855, 1.488],
|
75 |
}
|
76 |
)
|
77 |
+
with col2:
|
78 |
+
st.line_chart(
|
79 |
+
pd.DataFrame(
|
80 |
+
{
|
81 |
+
"Apple": yf.download("AAPL", start="2023-01-01", end="2023-07-31")[
|
82 |
+
"Adj Close"
|
83 |
+
],
|
84 |
+
"Google": yf.download(
|
85 |
+
"GOOGL", start="2023-01-01", end="2023-07-31"
|
86 |
+
)["Adj Close"],
|
87 |
+
"Microsoft": yf.download(
|
88 |
+
"MSFT", start="2023-01-01", end="2023-07-31"
|
89 |
+
)["Adj Close"],
|
90 |
+
}
|
91 |
+
)
|
92 |
+
)
|
93 |
+
(
|
94 |
+
col1,
|
95 |
+
col2,
|
96 |
+
) = st.columns(2)
|
97 |
+
with col1:
|
98 |
+
data = pd.DataFrame(
|
99 |
+
{"X": [1, 2, 3, 4, 5], "Y1": [10, 16, 8, 14, 12], "Y2": [5, 8, 3, 6, 7]}
|
100 |
+
)
|
101 |
+
st.area_chart(data)
|
102 |
+
with col2:
|
103 |
+
st.bar_chart(
|
104 |
+
pd.DataFrame(np.random.randn(20, 3), columns=["Apple", "Banana", "Cherry"])
|
105 |
+
)
|
106 |
+
(
|
107 |
+
col1,
|
108 |
+
col2,
|
109 |
+
) = st.columns(2)
|
110 |
+
with col1:
|
111 |
+
st.write("Hello, world!")
|
112 |
with col2:
|
113 |
df = px.data.gapminder().query("year == 2007").query("continent == 'Americas'")
|
114 |
fig = px.pie(
|
|
|
121 |
)
|
122 |
fig.update_traces(textposition="inside", textinfo="percent+label")
|
123 |
st.plotly_chart(fig)
|
124 |
+
source = vds.cars()
|
125 |
+
chart = {
|
126 |
+
"mark": "point",
|
127 |
+
"encoding": {
|
128 |
+
"x": {"field": "Horsepower", "type": "quantitative"},
|
129 |
+
"y": {"field": "Miles_per_Gallon", "type": "quantitative"},
|
130 |
+
"color": {"field": "Origin", "type": "nominal"},
|
131 |
+
"shape": {"field": "Origin", "type": "nominal"},
|
132 |
+
},
|
133 |
+
}
|
134 |
+
tab1, tab2 = st.tabs(["Streamlit theme (default)", "Vega-Lite native theme"])
|
135 |
+
with tab1:
|
136 |
+
st.vega_lite_chart(source, chart, theme="streamlit", use_container_width=True)
|
137 |
+
with tab2:
|
138 |
+
st.vega_lite_chart(source, chart, theme=None, use_container_width=True)
|
139 |
+
(
|
140 |
+
col1,
|
141 |
+
col2,
|
142 |
+
) = st.columns(2)
|
143 |
+
with col1:
|
144 |
+
st.video("https://www.youtube.com/watch?v=50hVvC7gMR8&t=5s", format="video/mp4")
|
145 |
+
with col2:
|
146 |
+
st.image(
|
147 |
+
"https://assets-global.website-files.com/59e16042ec229e00016d3a66/6441d5f76d21e1e4dee9ffa2_Gen%20AI%20blog_Blog%20hero.png",
|
148 |
+
caption="Image Caption",
|
149 |
+
)
|
150 |
+
st.plotly_chart(
|
151 |
+
ff.create_distplot(
|
152 |
+
[np.random.randn(200) - 2, np.random.randn(200), np.random.randn(200) + 2],
|
153 |
+
["Negative Shift", "Normal", "Positive Shift"],
|
154 |
+
bin_size=[0.1, 0.25, 0.5],
|
155 |
+
),
|
156 |
+
use_container_width=True,
|
157 |
+
)
|
158 |
+
st.header(" auto generated by sketch2streamiit")
|
159 |
|
160 |
|
161 |
if __name__ == "__main__":
|