Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -6,7 +6,7 @@ from inseq import FeatureAttributionOutput
|
|
6 |
st.set_page_config(layout="wide")
|
7 |
|
8 |
dataset = load_dataset("GroNLP/divemt")
|
9 |
-
attribution_path = "https://huggingface.co/datasets/inseq/divemt_attributions/resolve/main/divemt-attributions/
|
10 |
df = dataset["train"].to_pandas()
|
11 |
unique_src = df[["item_id", "src_text"]].drop_duplicates(subset="item_id")
|
12 |
langs = list(df["lang_id"].unique())
|
@@ -19,6 +19,15 @@ st.markdown("""
|
|
19 |
##### Inside every generated language section, you will find the translations for all the available settings, alongside aligned edits and a collection of collected metadata. You can filter the shown settings to see the aligned edits annotations.
|
20 |
""")
|
21 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
with st.expander("Explore examples"):
|
23 |
col1, col2, _ = st.columns([3,2,5])
|
24 |
with col1:
|
@@ -94,7 +103,7 @@ for lang in langs:
|
|
94 |
st.markdown(f"<b>Attributions</b>:", unsafe_allow_html=True)
|
95 |
st.text("Click on checkboxes to show/hide the respective attributions computed with mBART 1-to-50.")
|
96 |
for sentence_type in ["mt", "pe", "diff"]:
|
97 |
-
url = attribution_path.format(idx=item_id, setting=setting, sentence_type=sentence_type, lang=lang)
|
98 |
try:
|
99 |
g = urllib.request.urlopen(url)
|
100 |
fpath = f"attr_{lang}_{sentence_type}.json.gz"
|
|
|
6 |
st.set_page_config(layout="wide")
|
7 |
|
8 |
dataset = load_dataset("GroNLP/divemt")
|
9 |
+
attribution_path = "https://huggingface.co/datasets/inseq/divemt_attributions/resolve/main/divemt-attributions/{lang}/{idx}_{lang}_gradl2_{setting}_{sentence_type}.json.gz"
|
10 |
df = dataset["train"].to_pandas()
|
11 |
unique_src = df[["item_id", "src_text"]].drop_duplicates(subset="item_id")
|
12 |
langs = list(df["lang_id"].unique())
|
|
|
19 |
##### Inside every generated language section, you will find the translations for all the available settings, alongside aligned edits and a collection of collected metadata. You can filter the shown settings to see the aligned edits annotations.
|
20 |
""")
|
21 |
|
22 |
+
divemt_to_spacy_lang_map = {
|
23 |
+
"ara": "ar",
|
24 |
+
"nld": "nl",
|
25 |
+
"ita": "it",
|
26 |
+
"tur": "tr",
|
27 |
+
"ukr": "uk",
|
28 |
+
"vie": "vi",
|
29 |
+
}
|
30 |
+
|
31 |
with st.expander("Explore examples"):
|
32 |
col1, col2, _ = st.columns([3,2,5])
|
33 |
with col1:
|
|
|
103 |
st.markdown(f"<b>Attributions</b>:", unsafe_allow_html=True)
|
104 |
st.text("Click on checkboxes to show/hide the respective attributions computed with mBART 1-to-50.")
|
105 |
for sentence_type in ["mt", "pe", "diff"]:
|
106 |
+
url = attribution_path.format(idx=item_id, setting=setting, sentence_type=sentence_type, lang=divemt_to_spacy_lang_map[lang])
|
107 |
try:
|
108 |
g = urllib.request.urlopen(url)
|
109 |
fpath = f"attr_{lang}_{sentence_type}.json.gz"
|