import os from shiny import module, App, ui, render, reactive import fastf1 as ff1 import matplotlib.pyplot as plt from matplotlib.collections import LineCollection from matplotlib import cm import numpy as np import shinyswatch # Define drivers drivers_2023 = {'Fastest driver': 'Fastest driver', 'VER': 'Max Verstappen', 'NOR': 'Lando Norris', 'GAS': 'Pierre Gasly', 'PER': 'Sergio Perez', 'ALO': 'Fernando Alonso', 'LEC': 'Charles Leclerc', 'STR': 'Lance Stroll', 'MAG': 'Kevin Magnussen', 'TSU': 'Yuki Tsunoda', 'ALB': 'Alexander Albon', 'ZHO': 'Guanyu Zhou', 'HUL': 'Nico Hülkenberg', 'OCO': 'Esteban Ocon', 'HAM': 'Lewis Hamilton', 'SAI': 'Carlos Sainz', 'RUS': 'George Russel', 'BOT': 'Valteri Bottas', 'PIA': 'Oscar Piastri', 'VRI': 'Nyck de Vries', 'SAR': 'Logan Sargeant', 'RIC': 'Daniel Ricciardo'} drivers_2022 = {'Fastest driver': 'Fastest driver', 'VER': 'Max Verstappen', 'NOR': 'Lando Norris', 'GAS': 'Pierre Gasly', 'PER': 'Sergio Perez', 'ALO': 'Fernando Alonso', 'LEC': 'Charles Leclerc', 'STR': 'Lance Stroll', 'MAG': 'Kevin Magnussen', 'TSU': 'Yuki Tsunoda', 'ALB': 'Alexander Albon', 'ZHO': 'Guanyu Zhou', 'HUL': 'Nico Hülkenberg', 'OCO': 'Esteban Ocon', 'HAM': 'Lewis Hamilton', 'SAI': 'Carlos Sainz', 'RUS': 'George Russel', 'BOT': 'Valteri Bottas', 'VRI': 'Nyck de Vries', 'VET': 'Sebastian Vettel', 'RIC': 'Daniel Ricciardo', 'MSC': 'Mick Schumacher', 'LAT': 'Nicolas Latifi'} @module.ui def driver_ui(custom_label): return ui.input_select( custom_label, label="Select driver 1:", choices = ["Fastest driver"], selected = "Fastest driver" ) @module.server def driver_sever(custom_label): return None