dvaz commited on
Commit
d6e82ba
·
1 Parent(s): 58a88de

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +20 -436
app.py CHANGED
@@ -3,450 +3,34 @@ import streamlit as st
3
  import yfinance as yf
4
  import streamlit.components.v1 as components
5
  from requests_html import HTMLSession
 
6
 
 
7
 
8
 
9
- menu=['Home','Sport news','Crypto','Sales','Registeration form by streamlit','Online register step by step','Registeration form by component,Html']
10
- ch=st.sidebar.selectbox('Menu',menu)
11
 
 
 
12
 
13
 
14
 
15
 
16
- if ch=='Home':
17
- st.title('Test python projects')
 
18
  st.write('This is a homepage to run and test different python scripts!')
19
- if ch== 'Sport news':
20
- st.title('Sport news')
21
- ti=st.text_input('Text input')
22
- if len(ti)>0:
23
- r=requests.get('https://search-api.varzesh3.com/v1.0/query?q='+ti)
24
- x=r.json()
25
- for i in x['news']:
26
- st.subheader(i['title'])
27
- st.success(i['publishedOn'])
28
- st.write(i['shortDescription'])
29
- st.image(i['picture'])
30
- st.write('--------------------------------------------')
31
 
32
 
33
-
34
-
35
-
36
-
37
-
38
- if ch== 'Crypto':
39
- list_asset = ['BTC-USD', 'ETH-USD', 'DOGE-USD']
40
- ms = st.multiselect('choose asset', list_asset)
41
- dates1 = st.date_input('from')
42
- dates2 = st.date_input('to')
43
-
44
- if len(ms) > 0:
45
- df = yf.download(ms, dates1, dates2)
46
- st.write(df)
47
- df2 = yf.download(ms, dates1, dates2)['Close']
48
- st.line_chart(df2)
49
-
50
-
51
-
52
-
53
-
54
-
55
-
56
-
57
-
58
-
59
- if ch == 'Sales':
60
- st.title('Good deals from stores below:')
61
- url = requests.get('https://www.cheapshark.com/api/1.0/stores')
62
- x = url.json()
63
-
64
- for i in x:
65
- st.write(i['storeName'] )
66
-
67
- url2 = requests.get('https://www.cheapshark.com/api/1.0/deals?storeID=1&upperPrice=15')
68
- y = url2.json()
69
-
70
- for j in y:
71
- st.write('------------------------------------------')
72
- st.write('Game name: '+j['title'])
73
- st.write('ID: '+j['gameID'])
74
- st.write('New price: '+j['salePrice'])
75
- st.write('Old price: '+j['normalPrice'])
76
- st.write(j['thumb'])
77
- st.write('------------------------------------------')
78
-
79
-
80
-
81
-
82
-
83
-
84
-
85
-
86
-
87
-
88
- if ch == 'Registeration form by streamlit':
89
- st.title('Registration form')
90
-
91
-
92
- st.subheader('Customer information')
93
- ct = ['Private','Business']
94
- ctype = st.selectbox('Customer type', ct)
95
-
96
-
97
-
98
- if ctype == 'Private' :
99
-
100
- cemail = st.text_input('Email')
101
-
102
- rcemail = st.text_input('Repeat Email')
103
- if cemail != rcemail :
104
- st.warning('Email does not match')
105
- else:
106
- st.success('Please note that it is very important that your email is correct, as all communication and invoices will be sent by email.')
107
-
108
- cname = st.text_input('Name and family name')
109
-
110
- caddress = st.text_input('Address')
111
-
112
-
113
- cpcode = st.text_input('Postal code')
114
-
115
-
116
- ccity = st.text_input('City')
117
-
118
-
119
- cphone = st.text_input('Phone')
120
-
121
-
122
- else:
123
-
124
- cemail = st.text_input('Email')
125
-
126
- rcemail = st.text_input('Repeat Email')
127
- if cemail != rcemail :
128
- st.warning('Email does not match')
129
- else:
130
- st.success('Please note that it is very important that your email is correct, as all communication and invoices will be sent by email.')
131
-
132
- ccvr = st.text_input('CVR number')
133
-
134
-
135
- company = st.text_input('Company name')
136
-
137
-
138
- caddress = st.text_input('Address')
139
-
140
-
141
- cpcode = st.text_input('Postal code')
142
-
143
-
144
- ccity = st.text_input('City')
145
-
146
-
147
- cphone = st.text_input('Phone')
148
-
149
-
150
- st.subheader('Subscription')
151
- pack=st.radio('package', ['Gold','silver','bronz'],horizontal=True)
152
- if 'Gold' in pack:
153
- st.success('Kr. 1185.00 årligt inkl. moms')
154
- if 'silver' in pack:
155
- st.success('885.00 årligt inkl. moms')
156
- if 'bronz' in pack:
157
- st.success('585.00 årligt inkl. moms')
158
-
159
- goog=st.radio('include google map', ['Yes','No'],horizontal=True)
160
- if 'Yes' in goog:
161
- st.success('Kr. 75.00 årligt inkl. moms')
162
-
163
- alarm=st.radio('include alarmcentral', ['Yes','No'],horizontal=True)
164
- if 'Yes' in alarm:
165
- st.success('Tilvælg alarmcentral + 400.00 årligt inkl. moms')
166
- ins=['Topdanmark Forsikring A/S','Tryg Forsikring A/S','ALG Europe','Alka Forsikring','Alm. Brand Forsikring A/S','Andet']
167
- ins2=st.selectbox('Insurance company',ins)
168
-
169
-
170
- st.subheader('Vehicle')
171
-
172
- plate = st.text_input('Registration Plate')
173
-
174
- brand = st.text_input('Brand')
175
-
176
- model = st.text_input('Model')
177
-
178
- year = st.text_input('Year')
179
-
180
-
181
- submitted = st.button("Submit")
182
-
183
-
184
-
185
-
186
-
187
-
188
-
189
-
190
-
191
-
192
-
193
-
194
- if ch == 'Online register step by step':
195
- st.title('Online Bestil forsikringstracker')
196
-
197
- st.subheader('Customer information')
198
-
199
- ct = ['--Select--','Private','Business']
200
- ctype = st.selectbox('Customer type', ct)
201
- if '--Select--' in ctype:
202
- st.stop()
203
-
204
- cemail = st.text_input('Email')
205
- if not cemail:
206
- st.stop()
207
-
208
- rcemail = st.text_input('Repeat Email')
209
- if not rcemail:
210
- st.stop()
211
-
212
- if cemail != rcemail :
213
- st.warning('Email does not match')
214
- st.stop()
215
- else:
216
- st.success('We will send login infomation to this email.')
217
-
218
-
219
-
220
- if ctype == 'Private' :
221
-
222
- cname = st.text_input('Name and family name')
223
- if not cname:
224
- st.stop()
225
-
226
- caddress = st.text_input('Address')
227
- if not caddress:
228
- st.stop()
229
-
230
- cpcode = st.text_input('Postal code')
231
- if not cpcode:
232
- st.stop()
233
-
234
- ccity = st.text_input('City')
235
- if not ccity:
236
- st.stop()
237
-
238
- cphone = st.text_input('Phone')
239
- if not cphone:
240
- st.stop()
241
-
242
- else:
243
- ccvr = st.text_input('CVR number')
244
- if not ccvr:
245
- st.stop()
246
-
247
- company = st.text_input('Company name')
248
- if not company:
249
- st.stop()
250
-
251
- caddress = st.text_input('Address')
252
- if not company:
253
- st.stop()
254
-
255
- cpcode = st.text_input('Postal code')
256
- if not cpcode:
257
- st.stop()
258
-
259
- ccity = st.text_input('City')
260
- if not ccity:
261
- st.stop()
262
-
263
- cphone = st.text_input('Phone')
264
- if not cphone:
265
- st.stop()
266
-
267
-
268
- st.subheader('Subscription')
269
- pack=st.radio('package', ['Gold','silver','bronz','<--- choose'],horizontal=True,index=3)
270
- if '<--- choose' in pack:
271
- st.stop()
272
- if 'Gold' in pack:
273
- st.success('Kr. 1185.00 årligt inkl. moms')
274
- if 'silver' in pack:
275
- st.success('885.00 årligt inkl. moms')
276
- if 'bronz' in pack:
277
- st.success('585.00 årligt inkl. moms')
278
-
279
- goog=st.radio('include google map', ['Yes','No','<--- choose'],horizontal=True,index=2)
280
- if '<--- choose' in goog:
281
- st.stop()
282
- if 'Yes' in goog:
283
- st.success('Kr. 75.00 årligt inkl. moms')
284
-
285
- alarm=st.radio('Include alarmcentral', ['Yes','No','<--- choose'],horizontal=True,index=2)
286
- if '<--- choose' in alarm:
287
- st.stop()
288
- if 'Yes' in alarm:
289
- st.success('Tilvælg alarmcentral + 400.00 årligt inkl. moms')
290
- ins=['--Select--','Topdanmark Forsikring A/S','Tryg Forsikring A/S','ALG Europe','Alka Forsikring','Alm. Brand Forsikring A/S','Andet']
291
-
292
- ins2=st.selectbox('Your car insurance company',ins)
293
- if ins2 == '--Select--':
294
- st.stop()
295
-
296
- st.subheader('Vehicle')
297
-
298
- plate = st.text_input('Registration Plate')
299
- if not plate:
300
- st.stop()
301
-
302
- brand = st.text_input('Brand')
303
- if not brand:
304
- st.stop()
305
-
306
- model = st.text_input('Model')
307
- if not model:
308
- st.stop()
309
-
310
-
311
- year = st.text_input('Year')
312
- if not year:
313
- st.stop()
314
-
315
-
316
- subm=st.button('Send')
317
- if subm:
318
- st.write('Check your email to continue')
319
-
320
-
321
-
322
-
323
-
324
-
325
-
326
-
327
-
328
-
329
- if ch == 'Registeration form by component,Html':
330
-
331
- #define css
332
-
333
-
334
-
335
-
336
- #define html
337
- components.html("""
338
- <!doctype html>
339
-
340
- <html>
341
- <head>
342
-
343
- </head>
344
- <script language="Javascript">
345
- function hideA(x) {
346
- if (x.checked) {
347
- document.getElementById("A").style.display = "none";
348
- document.getElementById("B").style.display = "initial";
349
- document.getElementById('option1').checked = true;
350
- }
351
- }
352
-
353
- function hideB(x) {
354
- if (x.checked) {
355
- document.getElementById("B").style.display = "none";
356
- document.getElementById("A").style.display = "initial";
357
- document.getElementById('option4').checked = true;
358
- }
359
- }
360
-
361
- </script>
362
-
363
- <body>
364
- <h1>Tilmeldingsformular</h1>
365
-
366
-
367
-
368
-
369
- <div id="A">
370
-
371
- <form method="post" >
372
- Status:
373
- <input type="radio" name="c" id='option1' onchange="hideB(this)" value="1" checked="checked" >Ny kunde
374
- <input type="radio" name="c" id='option2' onchange="hideA(this)" value="2"> Eksisterende kunde
375
- <br><br>
376
- <input type="text" placeholder="Fornavn og Efternavn*" name="name" required minlength="4"/>
377
- <br><br>
378
- <input type="text" placeholder="Firmanavn" name="firma" />
379
- <br><br>
380
- <input type="email" placeholder="E-mail*" name="email" required/>
381
- <br><br>
382
- <input type="text" placeholder="Telefonnummer" name="tlf" />
383
- <br><br>
384
- <input type="text" placeholder="Post nr" name="post" />
385
- <br><br>
386
- <input type="text" placeholder="By" name="city" />
387
- <br><br>
388
- <input type="text" placeholder="Adresse" name="address" />
389
- <br><br>
390
- <input type="text" placeholder="Nummerplade*" name="plate" required minlength="4"/>
391
- <br><br>
392
- <input type="text" placeholder="Mærke" name="mark" />
393
- <br><br>
394
- <input type="text" placeholder="Model" name="model" />
395
- <br><br>
396
- <input type="text" placeholder="Årgang" name="year" />
397
- <br><br>
398
-
399
- Abonnement: <input type="radio" name="s" id="f" value="1" checked="checked"> ULTIMATE
400
- <input type="radio" name="s" id="k" value="2"> PREMIUM
401
- <input type="radio" name="s" id="p" value="3" > BASIC
402
- <br><br>
403
-
404
- <input type="text" placeholder="IMEI nr.*" name="imei" required/>
405
- <br><br>
406
-
407
- Enhed model: <input type="radio" name="m" value="1" checked="checked"> GT06E
408
- <!-- <input type="radio" name="m" value="2"> GV20
409
- <input type="radio" name="m" value="3" > ET25
410
- <input type="radio" name="m" value="9" checked="checked" > Unknown-->
411
- <br><br>
412
-
413
-
414
-
415
- <input type=submit value=Opret>
416
- </form>
417
- </div>
418
-
419
-
420
-
421
- <div id="B" style="display:none">
422
- <form method="post">
423
- Status:
424
- <input type="radio" name="c" id='option3' onchange="hideB(this)" value="1" >Ny kunde
425
- <input type="radio" name="c" id='option4' onchange="hideA(this)" value="2" checked="checked" > Eksisterende kunde
426
- <br><br>
427
- <input type="email" placeholder="E-mail*" name="email" required/>
428
- <br><br>
429
- <input type="text" placeholder="Nummerplade*" name="plate" required minlength="4"/>
430
- <br><br>
431
- <input type="text" placeholder="Mærke" name="mark" />
432
- <br><br>
433
- <input type="text" placeholder="Model" name="model" />
434
- <br><br>
435
- <input type="text" placeholder="Årgang" name="year" />
436
- <br><br>
437
- <input type="text" placeholder="IMEI nr.*" name="imei" required/>
438
- <br><br>
439
-
440
- Enhed model: <input type="radio" name="m" value="1" checked="checked"> GT06E
441
- <!--<input type="radio" name="m" value="2"> GV20
442
- <input type="radio" name="m" value="3" > ET25
443
- <input type="radio" name="m" value="9" > Unknown-->
444
- <br><br>
445
- <input type=submit value=Opret>
446
- </form>
447
- </div>
448
-
449
-
450
- </body>
451
- </html>
452
- """, height=1000)
 
3
  import yfinance as yf
4
  import streamlit.components.v1 as components
5
  from requests_html import HTMLSession
6
+ from streamlit_lottie import st_lottie
7
 
8
+ st.set_page_config('Home',":shark:","wide",menu_items={'About': "This is an *extremely* cool app!"})
9
 
10
 
 
 
11
 
12
+ x=requests.get('https://assets3.lottiefiles.com/packages/lf20_jtbfg2nb.json')
13
+ r=x.json()
14
 
15
 
16
 
17
 
18
+ with st.container():
19
+ st.subheader('Hi, I am Daniel :wave:')
20
+ st.title('A Data Analyst From Denmark')
21
  st.write('This is a homepage to run and test different python scripts!')
 
 
 
 
 
 
 
 
 
 
 
 
22
 
23
 
24
+ with st.container():
25
+ st.write('---')
26
+ lc , rc =st.columns(2)
27
+ with lc:
28
+ st.header('What i do')
29
+ st.write('##')
30
+ st.write('''
31
+ - 1111111111111111111
32
+ - 2222222222222222222
33
+ - 3333333333333333333
34
+ ''')
35
+ with rc:
36
+ st_lottie(r,height=300)