|
import streamlit.components.v1 as components |
|
import streamlit as st |
|
import pandas as pd |
|
|
|
|
|
def create_data_input_table(datapoint, col_names): |
|
st.subheader("Flagged Transaction:") |
|
data = datapoint.iloc[0].tolist() |
|
data[7:12] = [bool(value) for value in data[7:12]] |
|
df = pd.DataFrame({"Feature name": col_names, "Value": data }) |
|
st.dataframe(df, hide_index=True, width=450, height=35*len(df)+38) |
|
|
|
|
|
def create_table(texts, values, title): |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
df = pd.DataFrame({"Feature Explanation": texts, 'Value': values}) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
st.markdown(f'#### {title}') |
|
|
|
|
|
|
|
|
|
header = { |
|
'selector': 'th', |
|
'props': 'background-color: #000066; color: white;' |
|
} |
|
|
|
|
|
|
|
|
|
|
|
df = df.style.set_table_styles([header]) |
|
|
|
|
|
st.dataframe(df, hide_index=True, width=450) |
|
|
|
|
|
def ChangeButtonColour(widget_label, font_color, background_color='transparent'): |
|
htmlstr = f""" |
|
<script> |
|
var elements = window.parent.document.querySelectorAll('button'); |
|
for (var i = 0; i < elements.length; ++i) {{ |
|
if (elements[i].innerText == '{widget_label}') {{ |
|
elements[i].style.color ='{font_color}'; |
|
elements[i].style.background = '{background_color}' |
|
}} |
|
}} |
|
</script> |
|
""" |
|
components.html(f"{htmlstr}", height=0, width=0) |