Spaces:
Running
on
CPU Upgrade
Running
on
CPU Upgrade
Jan Mühlnikel
commited on
Commit
·
6b796a5
1
Parent(s):
5ae70f9
adjusted mulimatch result tabel with metrics
Browse files
modules/multimatch_result_table.py
CHANGED
|
@@ -40,80 +40,99 @@ def show_multi_table(p1_df, p2_df):
|
|
| 40 |
row_from_p1["flag"] = "https://flagicons.lipis.dev/flags/4x3/xx.svg"
|
| 41 |
row_from_p2["flag"] = "https://flagicons.lipis.dev/flags/4x3/xx.svg"
|
| 42 |
|
| 43 |
-
print(row_from_p1["flag"].item())
|
| 44 |
|
| 45 |
# Correctly append rows to match_df
|
| 46 |
-
st.subheader(f"#{actual_ind}")
|
| 47 |
-
st.caption(f"Similarity: {round(row_from_p1['similarity'].item(), 4) * 100}%")
|
| 48 |
match_df = pd.concat([row_from_p1, row_from_p2], ignore_index=True)
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
#AgGrid(match_df)
|
| 53 |
|
| 54 |
-
st.
|
| 55 |
-
|
| 56 |
-
|
| 57 |
-
|
| 58 |
-
|
| 59 |
-
"
|
| 60 |
-
|
| 61 |
-
|
| 62 |
-
|
| 63 |
-
|
| 64 |
-
|
| 65 |
-
"
|
| 66 |
-
|
| 67 |
-
|
| 68 |
-
|
| 69 |
-
|
| 70 |
-
|
| 71 |
-
|
| 72 |
-
|
| 73 |
-
|
| 74 |
-
|
| 75 |
-
|
| 76 |
-
),
|
| 77 |
-
|
| 78 |
-
"
|
| 79 |
-
|
| 80 |
-
|
| 81 |
-
|
| 82 |
-
|
| 83 |
-
|
| 84 |
-
"
|
| 85 |
-
|
| 86 |
-
|
| 87 |
-
|
| 88 |
-
|
| 89 |
-
|
| 90 |
-
"
|
| 91 |
-
|
| 92 |
-
|
| 93 |
-
|
| 94 |
-
|
| 95 |
-
|
| 96 |
-
"
|
| 97 |
-
|
| 98 |
-
|
| 99 |
-
|
| 100 |
-
|
| 101 |
-
|
| 102 |
-
|
| 103 |
-
|
| 104 |
-
|
| 105 |
-
|
| 106 |
-
|
| 107 |
-
|
| 108 |
-
|
| 109 |
-
|
| 110 |
-
|
| 111 |
-
|
| 112 |
-
|
| 113 |
-
|
| 114 |
-
|
| 115 |
-
|
| 116 |
-
|
| 117 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 118 |
|
| 119 |
st.write("------------------")
|
|
|
|
| 40 |
row_from_p1["flag"] = "https://flagicons.lipis.dev/flags/4x3/xx.svg"
|
| 41 |
row_from_p2["flag"] = "https://flagicons.lipis.dev/flags/4x3/xx.svg"
|
| 42 |
|
| 43 |
+
#print(row_from_p1["flag"].item())
|
| 44 |
|
| 45 |
# Correctly append rows to match_df
|
| 46 |
+
#st.subheader(f"#{actual_ind}")
|
| 47 |
+
#st.caption(f"Similarity: {round(row_from_p1['similarity'].item(), 4) * 100}%")
|
| 48 |
match_df = pd.concat([row_from_p1, row_from_p2], ignore_index=True)
|
| 49 |
|
| 50 |
|
| 51 |
|
| 52 |
#AgGrid(match_df)
|
| 53 |
|
| 54 |
+
col1, col2 = st.columns([1, 12])
|
| 55 |
+
with col1:
|
| 56 |
+
|
| 57 |
+
# remove arrow from standart st.metric()
|
| 58 |
+
st.write(
|
| 59 |
+
"""
|
| 60 |
+
<style>
|
| 61 |
+
[data-testid="stMetricDelta"] svg {
|
| 62 |
+
display: none;
|
| 63 |
+
}
|
| 64 |
+
</style>
|
| 65 |
+
""",
|
| 66 |
+
unsafe_allow_html=True,
|
| 67 |
+
)
|
| 68 |
+
|
| 69 |
+
st.metric(label="Match", value=f"{actual_ind}", delta=f"~ {str(round(row_from_p1['similarity'].item(), 5) * 100)[:4]} %")
|
| 70 |
+
|
| 71 |
+
with col2:
|
| 72 |
+
st.write(" ")
|
| 73 |
+
st.dataframe(
|
| 74 |
+
match_df[["iati_id", "title_main", "orga_abbreviation", "client", "description_main", "country_name", "flag", "sdg_list", "crs_3_code_list", "crs_5_code_list"]],
|
| 75 |
+
use_container_width = True,
|
| 76 |
+
height = 35 + 35 * len(match_df),
|
| 77 |
+
column_config={
|
| 78 |
+
"iati_id": st.column_config.TextColumn(
|
| 79 |
+
"IATI ID",
|
| 80 |
+
help="IATI Project ID",
|
| 81 |
+
disabled=True,
|
| 82 |
+
width="small"
|
| 83 |
+
),
|
| 84 |
+
"orga_abbreviation": st.column_config.TextColumn(
|
| 85 |
+
"Organization",
|
| 86 |
+
help="If description not in English, description in other language provided",
|
| 87 |
+
disabled=True,
|
| 88 |
+
width="small"
|
| 89 |
+
),
|
| 90 |
+
"client": st.column_config.TextColumn(
|
| 91 |
+
"Client",
|
| 92 |
+
help="Client organization of customer",
|
| 93 |
+
disabled=True,
|
| 94 |
+
width="small"
|
| 95 |
+
),
|
| 96 |
+
"title_main": st.column_config.TextColumn(
|
| 97 |
+
"Title",
|
| 98 |
+
help="If title not in English, title in other language provided",
|
| 99 |
+
disabled=True,
|
| 100 |
+
width="large"
|
| 101 |
+
),
|
| 102 |
+
"description_main": st.column_config.TextColumn(
|
| 103 |
+
"Description",
|
| 104 |
+
help="If description not in English, description in other language provided",
|
| 105 |
+
disabled=True,
|
| 106 |
+
width="large"
|
| 107 |
+
),
|
| 108 |
+
"country_name": st.column_config.TextColumn(
|
| 109 |
+
"Country",
|
| 110 |
+
help="Country of project",
|
| 111 |
+
disabled=True,
|
| 112 |
+
width="small"
|
| 113 |
+
),
|
| 114 |
+
"flag": st.column_config.ImageColumn(
|
| 115 |
+
"Flag",
|
| 116 |
+
help="country flag",
|
| 117 |
+
width="small"
|
| 118 |
+
),
|
| 119 |
+
"sdg_list": st.column_config.ListColumn(
|
| 120 |
+
"SDG Prediction",
|
| 121 |
+
help="Prediction of SDG's",
|
| 122 |
+
width="small"
|
| 123 |
+
),
|
| 124 |
+
"crs_3_code_list": st.column_config.ListColumn(
|
| 125 |
+
"CRS 3",
|
| 126 |
+
help="CRS 3 code given by organization",
|
| 127 |
+
width="small"
|
| 128 |
+
),
|
| 129 |
+
"crs_5_code_list": st.column_config.ListColumn(
|
| 130 |
+
"CRS 5",
|
| 131 |
+
help="CRS 5 code given by organization",
|
| 132 |
+
width="small"
|
| 133 |
+
),
|
| 134 |
+
},
|
| 135 |
+
hide_index=True,
|
| 136 |
+
)
|
| 137 |
|
| 138 |
st.write("------------------")
|