def terms_to_html_table(terms):
    """Transform DataFrame of similar terms to an HTML table.

    Parameters
    ----------
    terms : pandas DataFrame, as returned by
        `NeuroQueryImageSearch()(img)["terms"]`

    Returns
    -------
    table : a `str` containing an HTML table.

    """
    nq_url = (
        "<a href='https://neuroquery.org/query?text={}' target='_blank'>{}</a>"
    )
    terms["Term"] = [
        nq_url.format(t.replace(" ", "+"), t) for t in terms["term"]
    ]
    terms = terms.loc[:, ["Term", "similarity"]]
    terms.rename(columns={"similarity": "Similarity"}, inplace=True)
    table = (
        terms.style.bar(
            subset=["Similarity"], color="lightgreen", width=95, vmin=0.0
        )
        .hide_index()
        .format({"Similarity": "{:.2f}"})
        .set_table_attributes('class="terms-table"')
        .render()
    )
    return table