Spaces:
Paused
Paused
Update app.py
Browse files
app.py
CHANGED
@@ -3,10 +3,7 @@ import pandas as pd
|
|
3 |
import plotly.express as px
|
4 |
import streamlit as st
|
5 |
|
6 |
-
|
7 |
-
"ACL 2022": "data/acl2022_spectre2-base.json",
|
8 |
-
"ACL 2023": "data/acl2023_spectre2-base.json",
|
9 |
-
}
|
10 |
|
11 |
|
12 |
def load_df(data_file: os.PathLike):
|
@@ -22,22 +19,39 @@ def load_df(data_file: os.PathLike):
|
|
22 |
|
23 |
|
24 |
@st.cache_data
|
25 |
-
def
|
26 |
-
return
|
27 |
|
28 |
-
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
|
33 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
34 |
|
|
|
35 |
|
36 |
-
external_stylesheets = ["https://codepen.io/chriddyp/pen/bWLwgP.css"]
|
37 |
|
38 |
|
39 |
fig = px.scatter(
|
40 |
-
|
41 |
x="x",
|
42 |
y="y",
|
43 |
color="cluster",
|
|
|
3 |
import plotly.express as px
|
4 |
import streamlit as st
|
5 |
|
6 |
+
DATA_FILE = "data/anthology-2020-23_specter2_base.json"
|
|
|
|
|
|
|
7 |
|
8 |
|
9 |
def load_df(data_file: os.PathLike):
|
|
|
19 |
|
20 |
|
21 |
@st.cache_data
|
22 |
+
def load_dataframe():
|
23 |
+
return load_df(DATA_FILE)
|
24 |
|
25 |
+
DF = load_dataframe()
|
26 |
|
27 |
+
with st.sidebar:
|
28 |
+
venues = st.multiselect(
|
29 |
+
"Venues",
|
30 |
+
["ACL", "EMNLP", "NAACL", "TACL"],
|
31 |
+
["ACL", "EMNLP", "NAACL", "TACL"],
|
32 |
+
)
|
33 |
+
|
34 |
+
start_year, end_year = st.select_slider("Publication year", options=("2020", "2021", "2022", "2023"), value=("2020", "2023"))
|
35 |
+
author_names = st.text_input('Author names (separated by comma)')
|
36 |
+
|
37 |
+
start_year = int(start_year)
|
38 |
+
end_year = int(end_year)
|
39 |
+
df = DF[(DF["year"] >= start_year) & (DF["year"] <= end_year)]
|
40 |
+
if len(venues) < 4:
|
41 |
+
selected_venues = [v.lower() for v in venues]
|
42 |
+
df = df[df["source"].isin(selected_venues)]
|
43 |
+
|
44 |
+
if author_names:
|
45 |
+
authors = [a.strip().lower() for a in author_names.split(",")]
|
46 |
+
author_mask = df.authors.apply(lambda x: all(a in x for a in authors))
|
47 |
+
df = df[author_mask]
|
48 |
|
49 |
+
st.write(f"Number of points: {df.shape[0]}")
|
50 |
|
|
|
51 |
|
52 |
|
53 |
fig = px.scatter(
|
54 |
+
df,
|
55 |
x="x",
|
56 |
y="y",
|
57 |
color="cluster",
|