update app.py
Browse files
app.py
CHANGED
@@ -2,21 +2,27 @@ import streamlit as st
|
|
2 |
import pandas as pd
|
3 |
import matplotlib.pyplot as plt
|
4 |
|
5 |
-
#
|
6 |
-
st.title("Ontology Benchmark Metrics")
|
7 |
-
|
8 |
-
# Load Excel file (assumed to be in the same directory)
|
9 |
df = pd.read_excel("metrics.xlsx")
|
10 |
|
11 |
-
|
|
|
|
|
12 |
st.subheader("Metrics Table")
|
13 |
-
st.dataframe(df)
|
14 |
|
15 |
-
#
|
16 |
-
|
17 |
-
metric = st.selectbox("Select column to visualize:", df.columns[1:])
|
18 |
|
19 |
-
|
20 |
-
|
21 |
-
st.
|
22 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2 |
import pandas as pd
|
3 |
import matplotlib.pyplot as plt
|
4 |
|
5 |
+
# Load the data
|
|
|
|
|
|
|
6 |
df = pd.read_excel("metrics.xlsx")
|
7 |
|
8 |
+
st.title("Ontology Benchmark Metrics Viewer")
|
9 |
+
|
10 |
+
# Show the dataset
|
11 |
st.subheader("Metrics Table")
|
12 |
+
st.dataframe(df, use_container_width=True)
|
13 |
|
14 |
+
# Drop non-numeric columns for metric selection
|
15 |
+
numeric_cols = df.select_dtypes(include=['float64', 'int64']).columns.tolist()
|
|
|
16 |
|
17 |
+
# Select a metric to visualize
|
18 |
+
st.subheader("Metric Visualization")
|
19 |
+
selected_metric = st.selectbox("Select a metric column:", numeric_cols)
|
20 |
|
21 |
+
# Plot the metric per ontology
|
22 |
+
fig, ax = plt.subplots(figsize=(10, 6))
|
23 |
+
df_sorted = df.sort_values(by=selected_metric, ascending=False)
|
24 |
+
ax.barh(df_sorted['Ontology ID'], df_sorted[selected_metric])
|
25 |
+
ax.set_xlabel(selected_metric)
|
26 |
+
ax.set_ylabel("Ontology ID")
|
27 |
+
ax.set_title(f"{selected_metric} by Ontology")
|
28 |
+
st.pyplot(fig)
|