Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -2,8 +2,13 @@ import requests
|
|
2 |
import streamlit as st
|
3 |
import yfinance as yf
|
4 |
|
5 |
-
menu=['Home','Sport news','Crypto','Sales']
|
6 |
ch=st.sidebar.selectbox('Menu',menu)
|
|
|
|
|
|
|
|
|
|
|
7 |
if ch=='Home':
|
8 |
st.title('Test python projects')
|
9 |
st.write('This is a homepage to run and test different python scripts!')
|
@@ -19,6 +24,13 @@ if ch== 'Sport news':
|
|
19 |
st.write(i['shortDescription'])
|
20 |
st.image(i['picture'])
|
21 |
st.write('--------------------------------------------')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
if ch== 'Crypto':
|
23 |
list_asset = ['BTC-USD', 'ETH-USD', 'DOGE-USD']
|
24 |
ms = st.multiselect('choose asset', list_asset)
|
@@ -31,6 +43,15 @@ if ch== 'Crypto':
|
|
31 |
df2 = yf.download(ms, dates1, dates2)['Close']
|
32 |
st.line_chart(df2)
|
33 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
if ch == 'Sales':
|
35 |
st.title('Good deals from stores below:')
|
36 |
url = requests.get('https://www.cheapshark.com/api/1.0/stores')
|
@@ -49,4 +70,243 @@ if ch == 'Sales':
|
|
49 |
st.write('New price: '+j['salePrice'])
|
50 |
st.write('Old price: '+j['normalPrice'])
|
51 |
st.write(j['thumb'])
|
52 |
-
st.write('------------------------------------------')
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import streamlit as st
|
3 |
import yfinance as yf
|
4 |
|
5 |
+
menu=['Home','Sport news','Crypto','Sales','Registeration form','Online register']
|
6 |
ch=st.sidebar.selectbox('Menu',menu)
|
7 |
+
|
8 |
+
|
9 |
+
|
10 |
+
|
11 |
+
|
12 |
if ch=='Home':
|
13 |
st.title('Test python projects')
|
14 |
st.write('This is a homepage to run and test different python scripts!')
|
|
|
24 |
st.write(i['shortDescription'])
|
25 |
st.image(i['picture'])
|
26 |
st.write('--------------------------------------------')
|
27 |
+
|
28 |
+
|
29 |
+
|
30 |
+
|
31 |
+
|
32 |
+
|
33 |
+
|
34 |
if ch== 'Crypto':
|
35 |
list_asset = ['BTC-USD', 'ETH-USD', 'DOGE-USD']
|
36 |
ms = st.multiselect('choose asset', list_asset)
|
|
|
43 |
df2 = yf.download(ms, dates1, dates2)['Close']
|
44 |
st.line_chart(df2)
|
45 |
|
46 |
+
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
+
|
52 |
+
|
53 |
+
|
54 |
+
|
55 |
if ch == 'Sales':
|
56 |
st.title('Good deals from stores below:')
|
57 |
url = requests.get('https://www.cheapshark.com/api/1.0/stores')
|
|
|
70 |
st.write('New price: '+j['salePrice'])
|
71 |
st.write('Old price: '+j['normalPrice'])
|
72 |
st.write(j['thumb'])
|
73 |
+
st.write('------------------------------------------')
|
74 |
+
|
75 |
+
|
76 |
+
|
77 |
+
|
78 |
+
|
79 |
+
|
80 |
+
|
81 |
+
|
82 |
+
|
83 |
+
|
84 |
+
if ch == 'Registeration form':
|
85 |
+
st.title('Registration form')
|
86 |
+
|
87 |
+
|
88 |
+
st.subheader('Customer information')
|
89 |
+
ct = ['Private','Business']
|
90 |
+
ctype = st.selectbox('Customer type', ct)
|
91 |
+
|
92 |
+
|
93 |
+
|
94 |
+
if ctype == 'Private' :
|
95 |
+
|
96 |
+
cemail = st.text_input('Email')
|
97 |
+
|
98 |
+
rcemail = st.text_input('Repeat Email')
|
99 |
+
if cemail != rcemail :
|
100 |
+
st.warning('Email does not match')
|
101 |
+
else:
|
102 |
+
st.success('Please note that it is very important that your email is correct, as all communication and invoices will be sent by email.')
|
103 |
+
|
104 |
+
cname = st.text_input('Name and family name')
|
105 |
+
|
106 |
+
caddress = st.text_input('Address')
|
107 |
+
|
108 |
+
|
109 |
+
cpcode = st.text_input('Postal code')
|
110 |
+
|
111 |
+
|
112 |
+
ccity = st.text_input('City')
|
113 |
+
|
114 |
+
|
115 |
+
cphone = st.text_input('Phone')
|
116 |
+
|
117 |
+
|
118 |
+
else:
|
119 |
+
|
120 |
+
cemail = st.text_input('Email')
|
121 |
+
|
122 |
+
rcemail = st.text_input('Repeat Email')
|
123 |
+
if cemail != rcemail :
|
124 |
+
st.warning('Email does not match')
|
125 |
+
else:
|
126 |
+
st.success('Please note that it is very important that your email is correct, as all communication and invoices will be sent by email.')
|
127 |
+
|
128 |
+
ccvr = st.text_input('CVR number')
|
129 |
+
|
130 |
+
|
131 |
+
company = st.text_input('Company name')
|
132 |
+
|
133 |
+
|
134 |
+
caddress = st.text_input('Address')
|
135 |
+
|
136 |
+
|
137 |
+
cpcode = st.text_input('Postal code')
|
138 |
+
|
139 |
+
|
140 |
+
ccity = st.text_input('City')
|
141 |
+
|
142 |
+
|
143 |
+
cphone = st.text_input('Phone')
|
144 |
+
|
145 |
+
|
146 |
+
st.subheader('Subscription')
|
147 |
+
pack=st.radio('package', ['Gold','silver','bronz'],horizontal=True)
|
148 |
+
if 'Gold' in pack:
|
149 |
+
st.success('Kr. 1185.00 årligt inkl. moms')
|
150 |
+
if 'silver' in pack:
|
151 |
+
st.success('885.00 årligt inkl. moms')
|
152 |
+
if 'bronz' in pack:
|
153 |
+
st.success('585.00 årligt inkl. moms')
|
154 |
+
|
155 |
+
goog=st.radio('include google map', ['Yes','No'],horizontal=True)
|
156 |
+
if 'Yes' in goog:
|
157 |
+
st.success('Kr. 75.00 årligt inkl. moms')
|
158 |
+
|
159 |
+
alarm=st.radio('include alarmcentral', ['Yes','No'],horizontal=True)
|
160 |
+
if 'Yes' in alarm:
|
161 |
+
st.success('Tilvælg alarmcentral + 400.00 årligt inkl. moms')
|
162 |
+
ins=['Topdanmark Forsikring A/S','Tryg Forsikring A/S','ALG Europe','Alka Forsikring','Alm. Brand Forsikring A/S','Andet']
|
163 |
+
ins2=st.selectbox('Insurance company',ins)
|
164 |
+
|
165 |
+
|
166 |
+
st.subheader('Vehicle')
|
167 |
+
|
168 |
+
plate = st.text_input('Registration Plate')
|
169 |
+
|
170 |
+
brand = st.text_input('Brand')
|
171 |
+
|
172 |
+
model = st.text_input('Model')
|
173 |
+
|
174 |
+
year = st.text_input('Year')
|
175 |
+
|
176 |
+
|
177 |
+
submitted = st.button("Submit")
|
178 |
+
|
179 |
+
|
180 |
+
|
181 |
+
|
182 |
+
|
183 |
+
|
184 |
+
|
185 |
+
|
186 |
+
|
187 |
+
|
188 |
+
|
189 |
+
|
190 |
+
if ch == 'Online register':
|
191 |
+
st.title('Online Bestil forsikringstracker')
|
192 |
+
|
193 |
+
st.subheader('Customer information')
|
194 |
+
|
195 |
+
ct = ['Private','Business']
|
196 |
+
ctype = st.selectbox('Customer type', ct)
|
197 |
+
|
198 |
+
cemail = st.text_input('Email')
|
199 |
+
if not cemail:
|
200 |
+
st.stop()
|
201 |
+
|
202 |
+
rcemail = st.text_input('Repeat Email')
|
203 |
+
if not rcemail:
|
204 |
+
st.stop()
|
205 |
+
|
206 |
+
if cemail != rcemail :
|
207 |
+
st.warning('Email does not match')
|
208 |
+
st.stop()
|
209 |
+
else:
|
210 |
+
st.success('We will send login infomation to this email.')
|
211 |
+
|
212 |
+
|
213 |
+
|
214 |
+
if ctype == 'Private' :
|
215 |
+
|
216 |
+
cname = st.text_input('Name and family name')
|
217 |
+
if not cname:
|
218 |
+
st.stop()
|
219 |
+
|
220 |
+
caddress = st.text_input('Address')
|
221 |
+
if not caddress:
|
222 |
+
st.stop()
|
223 |
+
|
224 |
+
cpcode = st.text_input('Postal code')
|
225 |
+
if not cpcode:
|
226 |
+
st.stop()
|
227 |
+
|
228 |
+
ccity = st.text_input('City')
|
229 |
+
if not ccity:
|
230 |
+
st.stop()
|
231 |
+
|
232 |
+
cphone = st.text_input('Phone')
|
233 |
+
if not cphone:
|
234 |
+
st.stop()
|
235 |
+
|
236 |
+
else:
|
237 |
+
ccvr = st.text_input('CVR number')
|
238 |
+
if not ccvr:
|
239 |
+
st.stop()
|
240 |
+
|
241 |
+
company = st.text_input('Company name')
|
242 |
+
if not company:
|
243 |
+
st.stop()
|
244 |
+
|
245 |
+
caddress = st.text_input('Address')
|
246 |
+
if not company:
|
247 |
+
st.stop()
|
248 |
+
|
249 |
+
cpcode = st.text_input('Postal code')
|
250 |
+
if not cpcode:
|
251 |
+
st.stop()
|
252 |
+
|
253 |
+
ccity = st.text_input('City')
|
254 |
+
if not ccity:
|
255 |
+
st.stop()
|
256 |
+
|
257 |
+
cphone = st.text_input('Phone')
|
258 |
+
if not cphone:
|
259 |
+
st.stop()
|
260 |
+
|
261 |
+
|
262 |
+
st.subheader('Subscription')
|
263 |
+
pack=st.radio('package', ['Gold','silver','bronz','<--- choose'],horizontal=True,index=3)
|
264 |
+
if '<--- choose' in pack:
|
265 |
+
st.stop()
|
266 |
+
if 'Gold' in pack:
|
267 |
+
st.success('Kr. 1185.00 årligt inkl. moms')
|
268 |
+
if 'silver' in pack:
|
269 |
+
st.success('885.00 årligt inkl. moms')
|
270 |
+
if 'bronz' in pack:
|
271 |
+
st.success('585.00 årligt inkl. moms')
|
272 |
+
|
273 |
+
goog=st.radio('include google map', ['Yes','No','<--- choose'],horizontal=True,index=2)
|
274 |
+
if '<--- choose' in goog:
|
275 |
+
st.stop()
|
276 |
+
if 'Yes' in goog:
|
277 |
+
st.success('Kr. 75.00 årligt inkl. moms')
|
278 |
+
|
279 |
+
alarm=st.radio('Include alarmcentral', ['Yes','No','<--- choose'],horizontal=True,index=2)
|
280 |
+
if '<--- choose' in alarm:
|
281 |
+
st.stop()
|
282 |
+
if 'Yes' in alarm:
|
283 |
+
st.success('Tilvælg alarmcentral + 400.00 årligt inkl. moms')
|
284 |
+
ins=['--Select--','Topdanmark Forsikring A/S','Tryg Forsikring A/S','ALG Europe','Alka Forsikring','Alm. Brand Forsikring A/S','Andet']
|
285 |
+
|
286 |
+
ins2=st.selectbox('Your car insurance company',ins)
|
287 |
+
if ins2 == '--Select--':
|
288 |
+
st.stop()
|
289 |
+
|
290 |
+
st.subheader('Vehicle')
|
291 |
+
|
292 |
+
plate = st.text_input('Registration Plate')
|
293 |
+
if not plate:
|
294 |
+
st.stop()
|
295 |
+
|
296 |
+
brand = st.text_input('Brand')
|
297 |
+
if not brand:
|
298 |
+
st.stop()
|
299 |
+
|
300 |
+
model = st.text_input('Model')
|
301 |
+
if not model:
|
302 |
+
st.stop()
|
303 |
+
|
304 |
+
|
305 |
+
year = st.text_input('Year')
|
306 |
+
if not year:
|
307 |
+
st.stop()
|
308 |
+
|
309 |
+
|
310 |
+
subm=st.button('Send')
|
311 |
+
if subm:
|
312 |
+
st.write('Check your email to continue')
|