f1 / app.py
tracinginsights's picture
Update app.py
de16828
raw
history blame
4.25 kB
from git import Repo
import os
import streamlit as st
#import streamlit_analytics
from PIL import Image
st.set_page_config(
page_title="TRACING INSIGHTS",
page_icon=None,
layout="wide",
initial_sidebar_state="expanded",
# menu_items={
# 'Get Help': 'https://www.extremelycoolapp.com/help',
# 'Report a bug': "https://www.extremelycoolapp.com/bug",
# 'About': "# This is a header. This is an *extremely* cool app!"
# }
)
GITHUB_PAT = os.environ['GITHUB']
if not os.path.exists('repo_directory'):
Repo.clone_from(f'https://tracinginsights:{GITHUB_PAT}@github.com/TracingInsights/F1_app.git', 'repo_directory' )
# import streamlit as st
# from repo_directory.main import get_laps_with_weather
# import pandas as pd
# YEAR_SELECTED = st.selectbox(
# 'Select Year',
# (2023, 2022, 2021, 2020, 2019, 2018))
# RACE_SELECTED = st.selectbox(
# 'Select Race',
# (1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23))
# SESSION_SELECTED = st.selectbox(
# 'Select Session',
# ('FP1', 'FP2', 'FP3', 'Q', 'SQ', 'R'))
# laps_with_weather, weather_data, f1session = get_laps_with_weather(YEAR_SELECTED, RACE_SELECTED, SESSION_SELECTED)
# laps_with_weather.to_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}.csv')
# st.dataframe(pd.read_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}.csv'))
# with open(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}.csv') as f:
# st.download_button('Click to Download LapTimes Data', f, file_name=f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}.csv')
# weather_data.to_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-weather.csv')
# st.dataframe(pd.read_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-weather.csv'))
# with open(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-weather.csv') as f:
# st.download_button('Click to Download Weather Data', f, file_name=f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-weather.csv')
# telemetry = main.get_pos_car_data(f1session)
# telemetry.to_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-Tel.csv')
# st.dataframe(pd.read_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-Tel.csv'))
# with open(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-Tel.csv') as f:
# st.download_button('Click to Download Telemetry Data', f, file_name=f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-Tel.csv')
# from repo_directory.st_functions import st_button, load_css
# #streamlit_analytics.start_tracking()
# #with streamlit_analytics.track():
# load_css()
# col1, col2, col3 = st.columns(3)
# col2.image(Image.open('Logo.png'))
# st.header('Tracing Insights')
# st.info("Home for F1 data-driven analytics, pre-race predictions, post-race analysis, dank memes you won't find anywhere else")
# icon_size = 20
# st_button('twitter', 'https://twitter.com/tracinginsights', 'Follow me on Twitter', icon_size)
# st_button('newsletter', 'https://tracinginsights.substack.com/', 'Sign up for my Newsletter', icon_size)
# st_button('', 'https://instagram.com/tracinginsights', 'Follow me on Instagram', icon_size)
# st_button('', 'https://www.reddit.com/r/TracingInsights/', 'Join r/TracingInsights sub-reddit', icon_size)
# st_button('', 'https://tracinginsights.creator-spring.com/', 'Shop Merch', icon_size)
# st_button('', 'https://discord.gg/ZabvWFNQFz', 'Join Discord', icon_size)
# st_button('youtube', 'https://www.youtube.com/@TracingInsights', 'Tracing Insights YouTube channel', icon_size)
# st_button('cup', 'https://www.buymeacoffee.com/tracinginsights', 'Buy me a Coffee', icon_size)
# st_button('', 'https://www.facebook.com/TracingInsights', 'Follow me on Facebook', icon_size)
# st_button('', 'https://www.linkedin.com/company/tracinginsights', 'Follow me on LinkedIn', icon_size)
# st_button('', 'https://www.patreon.com/tracinginsights', 'Patreon for exclusive content', icon_size)
# st_button('', 'https://www.twitch.tv/tracinginsights', 'Follow me on Twitch', icon_size)
# st_button('', 'https://clubhouse.com/@tracinginsights', 'Follow me on ClubHouse', icon_size)
# st_button('', 'https://paypal.me/TracingInsights?country.x=IN&locale.x=en_GB', 'PayPal', icon_size)
# st_button('', 'https://amazon.com/dp/B0BF2XK7Q6', 'Buy my Childrens book', icon_size)