from flask import url_for def df_to_table_html(df, additional_class=None): classes = 'table table-striped table-bordered' if additional_class is not None: classes += f" {additional_class}" full_table_html = df.to_html(classes=classes, escape=False, index=False) # Modify the table HTML to add links to model names for model in df['Model']: model_link = f'{model}' full_table_html = full_table_html.replace(f'>{model}<', f'>{model_link}<') return full_table_html