Spaces:
Sleeping
Sleeping
h2o-llmappstudio
commited on
Commit
•
544fb43
1
Parent(s):
e134eb6
Upload folder using huggingface_hub
Browse files
app.py
CHANGED
@@ -26,109 +26,27 @@ 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 |
-
|
|
|
36 |
with col2:
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
-
if st.button("
|
41 |
st.write("Button clicked!")
|
42 |
-
st.subheader("
|
43 |
-
|
44 |
-
"https://
|
45 |
-
|
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,
|
111 |
-
) = st.columns(2)
|
112 |
-
with col1:
|
113 |
-
st.table(
|
114 |
-
{
|
115 |
-
"Country": ["USA", "Canada", "UK", "Australia"],
|
116 |
-
"Population (millions)": [331, 38, 66, 25],
|
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(
|
123 |
-
df,
|
124 |
-
values="pop",
|
125 |
-
names="country",
|
126 |
-
title="Population of American continent",
|
127 |
-
hover_data=["lifeExp"],
|
128 |
-
labels={"lifeExp": "life expectancy"},
|
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.title(" Image Prediction (Computer Vision)")
|
30 |
+
option = st.selectbox(" ImageNet / CoCo", [" ImageNet ", " CoCo"])
|
31 |
+
value = st.slider(" Threshold", min_value=0, max_value=100, value=50, key=89)
|
32 |
(
|
33 |
col1,
|
34 |
col2,
|
35 |
) = st.columns(2)
|
36 |
with col1:
|
37 |
+
if st.checkbox(" Remove Noise"):
|
38 |
+
st.write("Checkbox checked!")
|
39 |
with col2:
|
40 |
+
if st.checkbox(" Increase Resolution"):
|
41 |
+
st.write("Checkbox checked!")
|
42 |
+
uploaded_file = st.file_uploader("Choose a file", type=["jpg", "png", "mp3"])
|
43 |
+
if st.button(" Predict"):
|
44 |
st.write("Button clicked!")
|
45 |
+
st.subheader(" Original vs Predicted")
|
46 |
+
image_comparison(
|
47 |
+
img1="https://www.imgonline.com.ua/examples/red-yellow-flower.jpg",
|
48 |
+
img2="https://lettatai.sirv.com/imgonline-com-ua-Negative-lYz1br1SWE.jpg",
|
49 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
50 |
|
51 |
|
52 |
if __name__ == "__main__":
|