Spaces:
Running
Running
Praveen998
commited on
Commit
•
4d84794
1
Parent(s):
03e560e
Upload folder using huggingface_hub
Browse files- app.py +25 -125
- requirements.txt +2 -1
app.py
CHANGED
@@ -26,7 +26,31 @@ def on_btn_click():
|
|
26 |
|
27 |
|
28 |
def main():
|
29 |
-
st.title("
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
(
|
31 |
col1,
|
32 |
col2,
|
@@ -52,133 +76,9 @@ def main():
|
|
52 |
{"X": [1, 2, 3, 4, 5], "Y1": [10, 16, 8, 14, 12], "Y2": [5, 8, 3, 6, 7]}
|
53 |
)
|
54 |
st.area_chart(data)
|
55 |
-
st.plotly_chart(
|
56 |
-
ff.create_distplot(
|
57 |
-
[np.random.randn(200) - 2, np.random.randn(200), np.random.randn(200) + 2],
|
58 |
-
["Negative Shift", "Normal", "Positive Shift"],
|
59 |
-
bin_size=[0.1, 0.25, 0.5],
|
60 |
-
),
|
61 |
-
use_container_width=True,
|
62 |
-
)
|
63 |
-
source = vds.cars()
|
64 |
-
chart = {
|
65 |
-
"mark": "point",
|
66 |
-
"encoding": {
|
67 |
-
"x": {"field": "Horsepower", "type": "quantitative"},
|
68 |
-
"y": {"field": "Miles_per_Gallon", "type": "quantitative"},
|
69 |
-
"color": {"field": "Origin", "type": "nominal"},
|
70 |
-
"shape": {"field": "Origin", "type": "nominal"},
|
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,
|
106 |
-
initial_view_state=pdk.ViewState(
|
107 |
-
latitude=37.76, longitude=-122.4, zoom=11, pitch=50
|
108 |
-
),
|
109 |
-
layers=[
|
110 |
-
pdk.Layer(
|
111 |
-
"HexagonLayer",
|
112 |
-
data=pd.DataFrame(
|
113 |
-
np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],
|
114 |
-
columns=["lat", "lon"],
|
115 |
-
),
|
116 |
-
get_position="[lon, lat]",
|
117 |
-
radius=200,
|
118 |
-
elevation_scale=4,
|
119 |
-
elevation_range=[0, 1000],
|
120 |
-
pickable=True,
|
121 |
-
extruded=True,
|
122 |
-
),
|
123 |
-
pdk.Layer(
|
124 |
-
"ScatterplotLayer",
|
125 |
-
data=pd.DataFrame(
|
126 |
-
np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],
|
127 |
-
columns=["lat", "lon"],
|
128 |
-
),
|
129 |
-
get_position="[lon, lat]",
|
130 |
-
get_color="[200, 30, 0, 160]",
|
131 |
-
get_radius=200,
|
132 |
-
),
|
133 |
-
],
|
134 |
-
)
|
135 |
-
)
|
136 |
-
import datetime
|
137 |
-
|
138 |
-
np.random.seed(1)
|
139 |
-
programmers = ["Alex", "Nicole", "Sara", "Etienne", "Chelsea", "Jody", "Marianne"]
|
140 |
-
base = datetime.datetime.today()
|
141 |
-
dates = base - np.arange(180) * datetime.timedelta(days=1)
|
142 |
-
z = np.random.poisson(size=(len(programmers), len(dates)))
|
143 |
-
fig = go.Figure(data=go.Heatmap(z=z, x=dates, y=programmers, colorscale="Viridis"))
|
144 |
-
fig.update_layout(title="GitHub commits per day", xaxis_nticks=36)
|
145 |
-
st.plotly_chart(fig)
|
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 |
-
fig.update_layout(margin=dict(t=0, l=0, r=0, b=0))
|
181 |
-
st.plotly_chart(fig)
|
182 |
|
183 |
|
184 |
if __name__ == "__main__":
|
|
|
26 |
|
27 |
|
28 |
def main():
|
29 |
+
st.title(" Stock Forecasting App")
|
30 |
+
uploaded_file = st.file_uploader("Choose a file", type=["jpg", "png", "mp3"])
|
31 |
+
value = st.slider(
|
32 |
+
" Select Horizon Period", min_value=0, max_value=100, value=50, key=74
|
33 |
+
)
|
34 |
+
value = st.slider(" Folds", min_value=0, max_value=100, value=50, key=95)
|
35 |
+
if st.button(" start"):
|
36 |
+
st.write("Button clicked!")
|
37 |
+
st.title(" Training")
|
38 |
+
(
|
39 |
+
col1,
|
40 |
+
col2,
|
41 |
+
) = st.columns(2)
|
42 |
+
with col1:
|
43 |
+
st.table(
|
44 |
+
{
|
45 |
+
"Country": ["USA", "Canada", "UK", "Australia"],
|
46 |
+
"Population (millions)": [331, 38, 66, 25],
|
47 |
+
"GDP (trillion USD)": [22.675, 1.843, 2.855, 1.488],
|
48 |
+
}
|
49 |
+
)
|
50 |
+
with col2:
|
51 |
+
data = {"key": "value", "name": "John Doe", "age": 30}
|
52 |
+
st.json(data)
|
53 |
+
st.title(" Forecast")
|
54 |
(
|
55 |
col1,
|
56 |
col2,
|
|
|
76 |
{"X": [1, 2, 3, 4, 5], "Y1": [10, 16, 8, 14, 12], "Y2": [5, 8, 3, 6, 7]}
|
77 |
)
|
78 |
st.area_chart(data)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
79 |
st.bar_chart(
|
80 |
pd.DataFrame(np.random.randn(20, 3), columns=["Apple", "Banana", "Cherry"])
|
81 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
82 |
|
83 |
|
84 |
if __name__ == "__main__":
|
requirements.txt
CHANGED
@@ -5,4 +5,5 @@ vega_datasets
|
|
5 |
streamlit_image_comparison
|
6 |
plotly==5.14.1
|
7 |
altair
|
8 |
-
pydeck
|
|
|
|
5 |
streamlit_image_comparison
|
6 |
plotly==5.14.1
|
7 |
altair
|
8 |
+
pydeck
|
9 |
+
scipy
|