Spaces:
Sleeping
Sleeping
Commit
·
ad8d5aa
1
Parent(s):
c6c1795
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -26,87 +26,79 @@ def on_btn_click():
|
|
26 |
|
27 |
|
28 |
def main():
|
29 |
-
st.title("
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
audio_path = (
|
34 |
-
"https://docs.google.com/uc?export=open&id=16QSvoLWNxeqco_Wb2JvzaReSAw5ow6Cl"
|
35 |
)
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
|
41 |
-
|
42 |
-
|
43 |
-
Math:
|
44 |
-
|
45 |
-
Lift($L$) can be determined by Lift Coefficient ($C_L$) like the following
|
46 |
-
equation.
|
47 |
-
|
48 |
-
$$
|
49 |
-
L = \\frac{1}{2} \\rho v^2 S C_L
|
50 |
-
$$
|
51 |
-
|
52 |
-
~~~py
|
53 |
-
import streamlit as st
|
54 |
-
|
55 |
-
st.write("Python code block")
|
56 |
-
~~~
|
57 |
-
|
58 |
-
~~~js
|
59 |
-
console.log("Here is some JavaScript code")
|
60 |
-
~~~
|
61 |
-
"""
|
62 |
-
table_markdown = """A Table:
|
63 |
-
| Feature | Support |
|
64 |
-
| ----------: | :------------------- |
|
65 |
-
| CommonMark | 100% |
|
66 |
-
| GFM | 100% w/ `remark-gfm` |
|
67 |
-
"""
|
68 |
-
youtube_embed = """<iframe width="400" height="215" src="https://www.youtube.com/embed/LMQ5Gauy17k" title="YouTube video player" frameborder="0" allow="accelerometer; encrypted-media;"></iframe>"""
|
69 |
-
st.session_state.setdefault(
|
70 |
-
"past",
|
71 |
-
[
|
72 |
-
"plan text with line break",
|
73 |
-
'play the song "Dancing Vegetables"',
|
74 |
-
"show me image of cat",
|
75 |
-
"and video of it",
|
76 |
-
"show me some markdown sample",
|
77 |
-
"table in markdown",
|
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 |
if __name__ == "__main__":
|
|
|
26 |
|
27 |
|
28 |
def main():
|
29 |
+
st.title(" 3D Visualisation")
|
30 |
+
z_data = pd.read_csv(
|
31 |
+
"https://raw.githubusercontent.com/plotly/datasets/master/api_docs/mt_bruno_elevation.csv"
|
|
|
|
|
|
|
32 |
)
|
33 |
+
fig = go.Figure(data=go.Surface(z=z_data, showscale=False))
|
34 |
+
fig.update_layout(
|
35 |
+
title="Mt Bruno Elevation",
|
36 |
+
width=400,
|
37 |
+
height=400,
|
38 |
+
margin=dict(t=40, r=0, l=20, b=20),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
39 |
)
|
40 |
+
name = "default"
|
41 |
+
camera = dict(
|
42 |
+
up=dict(x=0, y=0, z=1),
|
43 |
+
center=dict(x=0, y=0, z=0),
|
44 |
+
eye=dict(x=1.25, y=1.25, z=1.25),
|
45 |
+
)
|
46 |
+
fig.update_layout(scene_camera=camera, title=name)
|
47 |
+
st.plotly_chart(fig)
|
48 |
+
df = px.data.election()
|
49 |
+
geojson = px.data.election_geojson()
|
50 |
+
fig = px.choropleth_mapbox(
|
51 |
+
df,
|
52 |
+
geojson=geojson,
|
53 |
+
color="Bergeron",
|
54 |
+
locations="district",
|
55 |
+
featureidkey="properties.district",
|
56 |
+
center={"lat": 45.5517, "lon": -73.7073},
|
57 |
+
mapbox_style="carto-positron",
|
58 |
+
zoom=9,
|
59 |
+
)
|
60 |
+
st.plotly_chart(fig)
|
61 |
+
fig = make_subplots(
|
62 |
+
rows=2,
|
63 |
+
cols=2,
|
64 |
+
specs=[
|
65 |
+
[{"type": "surface"}, {"type": "surface"}],
|
66 |
+
[{"type": "surface"}, {"type": "surface"}],
|
67 |
],
|
68 |
)
|
69 |
+
x = np.linspace(-5, 80, 10)
|
70 |
+
y = np.linspace(-5, 60, 10)
|
71 |
+
xGrid, yGrid = np.meshgrid(y, x)
|
72 |
+
z = xGrid**3 + yGrid**3
|
73 |
+
fig.add_trace(
|
74 |
+
go.Surface(x=x, y=y, z=z, colorscale="Viridis", showscale=False), row=1, col=1
|
75 |
+
)
|
76 |
+
fig.add_trace(
|
77 |
+
go.Surface(x=x, y=y, z=z, colorscale="RdBu", showscale=False), row=1, col=2
|
78 |
+
)
|
79 |
+
fig.add_trace(
|
80 |
+
go.Surface(x=x, y=y, z=z, colorscale="YlOrRd", showscale=False), row=2, col=1
|
81 |
+
)
|
82 |
+
fig.add_trace(
|
83 |
+
go.Surface(x=x, y=y, z=z, colorscale="YlGnBu", showscale=False), row=2, col=2
|
84 |
+
)
|
85 |
+
fig.update_layout(
|
86 |
+
title_text="3D subplots with different colorscales", height=800, width=800
|
87 |
+
)
|
88 |
+
st.plotly_chart(fig)
|
89 |
+
fig = px.scatter_3d(
|
90 |
+
px.data.iris(),
|
91 |
+
x="sepal_length",
|
92 |
+
y="sepal_width",
|
93 |
+
z="petal_width",
|
94 |
+
color="petal_length",
|
95 |
+
size="petal_length",
|
96 |
+
size_max=18,
|
97 |
+
symbol="species",
|
98 |
+
opacity=0.7,
|
99 |
+
)
|
100 |
+
fig.update_layout(margin=dict(l=0, r=0, b=0, t=0))
|
101 |
+
st.plotly_chart(fig)
|
102 |
|
103 |
|
104 |
if __name__ == "__main__":
|