Spaces:
Runtime error
Runtime error
import requests | |
import streamlit as st | |
import yfinance as yf | |
menu=['Home','Sport news','Crypto','Sales','Registeration form','Online register'] | |
ch=st.sidebar.selectbox('Menu',menu) | |
if ch=='Home': | |
st.title('Test python projects') | |
st.write('This is a homepage to run and test different python scripts!') | |
if ch== 'Sport news': | |
st.title('Sport news') | |
ti=st.text_input('Text input') | |
if len(ti)>0: | |
r=requests.get('https://search-api.varzesh3.com/v1.0/query?q='+ti) | |
x=r.json() | |
for i in x['news']: | |
st.subheader(i['title']) | |
st.success(i['publishedOn']) | |
st.write(i['shortDescription']) | |
st.image(i['picture']) | |
st.write('--------------------------------------------') | |
if ch== 'Crypto': | |
list_asset = ['BTC-USD', 'ETH-USD', 'DOGE-USD'] | |
ms = st.multiselect('choose asset', list_asset) | |
dates1 = st.date_input('from') | |
dates2 = st.date_input('to') | |
if len(ms) > 0: | |
df = yf.download(ms, dates1, dates2) | |
st.write(df) | |
df2 = yf.download(ms, dates1, dates2)['Close'] | |
st.line_chart(df2) | |
if ch == 'Sales': | |
st.title('Good deals from stores below:') | |
url = requests.get('https://www.cheapshark.com/api/1.0/stores') | |
x = url.json() | |
for i in x: | |
st.write(i['storeName'] ) | |
url2 = requests.get('https://www.cheapshark.com/api/1.0/deals?storeID=1&upperPrice=15') | |
y = url2.json() | |
for j in y: | |
st.write('------------------------------------------') | |
st.write('Game name: '+j['title']) | |
st.write('ID: '+j['gameID']) | |
st.write('New price: '+j['salePrice']) | |
st.write('Old price: '+j['normalPrice']) | |
st.write(j['thumb']) | |
st.write('------------------------------------------') | |
if ch == 'Registeration form': | |
st.title('Registration form') | |
st.subheader('Customer information') | |
ct = ['Private','Business'] | |
ctype = st.selectbox('Customer type', ct) | |
if ctype == 'Private' : | |
cemail = st.text_input('Email') | |
rcemail = st.text_input('Repeat Email') | |
if cemail != rcemail : | |
st.warning('Email does not match') | |
else: | |
st.success('Please note that it is very important that your email is correct, as all communication and invoices will be sent by email.') | |
cname = st.text_input('Name and family name') | |
caddress = st.text_input('Address') | |
cpcode = st.text_input('Postal code') | |
ccity = st.text_input('City') | |
cphone = st.text_input('Phone') | |
else: | |
cemail = st.text_input('Email') | |
rcemail = st.text_input('Repeat Email') | |
if cemail != rcemail : | |
st.warning('Email does not match') | |
else: | |
st.success('Please note that it is very important that your email is correct, as all communication and invoices will be sent by email.') | |
ccvr = st.text_input('CVR number') | |
company = st.text_input('Company name') | |
caddress = st.text_input('Address') | |
cpcode = st.text_input('Postal code') | |
ccity = st.text_input('City') | |
cphone = st.text_input('Phone') | |
st.subheader('Subscription') | |
pack=st.radio('package', ['Gold','silver','bronz'],horizontal=True) | |
if 'Gold' in pack: | |
st.success('Kr. 1185.00 årligt inkl. moms') | |
if 'silver' in pack: | |
st.success('885.00 årligt inkl. moms') | |
if 'bronz' in pack: | |
st.success('585.00 årligt inkl. moms') | |
goog=st.radio('include google map', ['Yes','No'],horizontal=True) | |
if 'Yes' in goog: | |
st.success('Kr. 75.00 årligt inkl. moms') | |
alarm=st.radio('include alarmcentral', ['Yes','No'],horizontal=True) | |
if 'Yes' in alarm: | |
st.success('Tilvælg alarmcentral + 400.00 årligt inkl. moms') | |
ins=['Topdanmark Forsikring A/S','Tryg Forsikring A/S','ALG Europe','Alka Forsikring','Alm. Brand Forsikring A/S','Andet'] | |
ins2=st.selectbox('Insurance company',ins) | |
st.subheader('Vehicle') | |
plate = st.text_input('Registration Plate') | |
brand = st.text_input('Brand') | |
model = st.text_input('Model') | |
year = st.text_input('Year') | |
submitted = st.button("Submit") | |
if ch == 'Online register': | |
st.title('Online Bestil forsikringstracker') | |
st.subheader('Customer information') | |
ct = ['Private','Business'] | |
ctype = st.selectbox('Customer type', ct) | |
cemail = st.text_input('Email') | |
if not cemail: | |
st.stop() | |
rcemail = st.text_input('Repeat Email') | |
if not rcemail: | |
st.stop() | |
if cemail != rcemail : | |
st.warning('Email does not match') | |
st.stop() | |
else: | |
st.success('We will send login infomation to this email.') | |
if ctype == 'Private' : | |
cname = st.text_input('Name and family name') | |
if not cname: | |
st.stop() | |
caddress = st.text_input('Address') | |
if not caddress: | |
st.stop() | |
cpcode = st.text_input('Postal code') | |
if not cpcode: | |
st.stop() | |
ccity = st.text_input('City') | |
if not ccity: | |
st.stop() | |
cphone = st.text_input('Phone') | |
if not cphone: | |
st.stop() | |
else: | |
ccvr = st.text_input('CVR number') | |
if not ccvr: | |
st.stop() | |
company = st.text_input('Company name') | |
if not company: | |
st.stop() | |
caddress = st.text_input('Address') | |
if not company: | |
st.stop() | |
cpcode = st.text_input('Postal code') | |
if not cpcode: | |
st.stop() | |
ccity = st.text_input('City') | |
if not ccity: | |
st.stop() | |
cphone = st.text_input('Phone') | |
if not cphone: | |
st.stop() | |
st.subheader('Subscription') | |
pack=st.radio('package', ['Gold','silver','bronz','<--- choose'],horizontal=True,index=3) | |
if '<--- choose' in pack: | |
st.stop() | |
if 'Gold' in pack: | |
st.success('Kr. 1185.00 årligt inkl. moms') | |
if 'silver' in pack: | |
st.success('885.00 årligt inkl. moms') | |
if 'bronz' in pack: | |
st.success('585.00 årligt inkl. moms') | |
goog=st.radio('include google map', ['Yes','No','<--- choose'],horizontal=True,index=2) | |
if '<--- choose' in goog: | |
st.stop() | |
if 'Yes' in goog: | |
st.success('Kr. 75.00 årligt inkl. moms') | |
alarm=st.radio('Include alarmcentral', ['Yes','No','<--- choose'],horizontal=True,index=2) | |
if '<--- choose' in alarm: | |
st.stop() | |
if 'Yes' in alarm: | |
st.success('Tilvælg alarmcentral + 400.00 årligt inkl. moms') | |
ins=['--Select--','Topdanmark Forsikring A/S','Tryg Forsikring A/S','ALG Europe','Alka Forsikring','Alm. Brand Forsikring A/S','Andet'] | |
ins2=st.selectbox('Your car insurance company',ins) | |
if ins2 == '--Select--': | |
st.stop() | |
st.subheader('Vehicle') | |
plate = st.text_input('Registration Plate') | |
if not plate: | |
st.stop() | |
brand = st.text_input('Brand') | |
if not brand: | |
st.stop() | |
model = st.text_input('Model') | |
if not model: | |
st.stop() | |
year = st.text_input('Year') | |
if not year: | |
st.stop() | |
subm=st.button('Send') | |
if subm: | |
st.write('Check your email to continue') | |