Spaces:
Runtime error
Runtime error
tracinginsights
commited on
Commit
·
fec3da1
1
Parent(s):
4fafb79
Update app.py
Browse files
app.py
CHANGED
@@ -21,6 +21,51 @@ GITHUB_PAT = os.environ['GITHUB']
|
|
21 |
if not os.path.exists('repo_directory'):
|
22 |
Repo.clone_from(f'https://tracinginsights:{GITHUB_PAT}@github.com/TracingInsights/F1_app.git', 'repo_directory' )
|
23 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
24 |
# from repo_directory.st_functions import st_button, load_css
|
25 |
|
26 |
|
|
|
21 |
if not os.path.exists('repo_directory'):
|
22 |
Repo.clone_from(f'https://tracinginsights:{GITHUB_PAT}@github.com/TracingInsights/F1_app.git', 'repo_directory' )
|
23 |
|
24 |
+
|
25 |
+
import streamlit as st
|
26 |
+
from repo_directory import main
|
27 |
+
|
28 |
+
import pandas as pd
|
29 |
+
|
30 |
+
YEAR_SELECTED = st.selectbox(
|
31 |
+
'Select Year',
|
32 |
+
(2023, 2022, 2021, 2020, 2019, 2018))
|
33 |
+
|
34 |
+
RACE_SELECTED = st.selectbox(
|
35 |
+
'Select Race',
|
36 |
+
(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23))
|
37 |
+
|
38 |
+
SESSION_SELECTED = st.selectbox(
|
39 |
+
'Select Session',
|
40 |
+
('FP1', 'FP2', 'FP3', 'Q', 'SQ', 'R'))
|
41 |
+
|
42 |
+
laps_with_weather, weather_data, f1session = main.get_laps_with_weather(YEAR_SELECTED, RACE_SELECTED, SESSION_SELECTED)
|
43 |
+
laps_with_weather.to_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}.csv')
|
44 |
+
st.dataframe(pd.read_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}.csv'))
|
45 |
+
with open(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}.csv') as f:
|
46 |
+
st.download_button('Click to Download LapTimes Data', f, file_name=f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}.csv')
|
47 |
+
|
48 |
+
|
49 |
+
|
50 |
+
|
51 |
+
weather_data.to_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-weather.csv')
|
52 |
+
st.dataframe(pd.read_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-weather.csv'))
|
53 |
+
|
54 |
+
with open(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-weather.csv') as f:
|
55 |
+
st.download_button('Click to Download Weather Data', f, file_name=f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-weather.csv')
|
56 |
+
|
57 |
+
telemetry = main.get_pos_car_data(f1session)
|
58 |
+
|
59 |
+
|
60 |
+
|
61 |
+
telemetry.to_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-Tel.csv')
|
62 |
+
st.dataframe(pd.read_csv(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-Tel.csv'))
|
63 |
+
|
64 |
+
|
65 |
+
with open(f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-Tel.csv') as f:
|
66 |
+
st.download_button('Click to Download Telemetry Data', f, file_name=f'{YEAR_SELECTED}-{RACE_SELECTED}-{SESSION}-Tel.csv')
|
67 |
+
|
68 |
+
|
69 |
# from repo_directory.st_functions import st_button, load_css
|
70 |
|
71 |
|