Spaces:
Sleeping
Sleeping
Merge branch 'main' of https://huggingface.co/spaces/butterswords/nlc-explorer
Browse files
app.py
CHANGED
@@ -2,8 +2,6 @@
|
|
2 |
import pandas as pd, spacy, nltk, numpy as np
|
3 |
from spacy.matcher import Matcher
|
4 |
nlp = spacy.load("en_core_web_lg")
|
5 |
-
nltk.download('omw-1.4')
|
6 |
-
nltk.download('wordnet')
|
7 |
from nltk.corpus import wordnet
|
8 |
|
9 |
#Import the libraries to support the model and predictions.
|
@@ -37,6 +35,8 @@ def prepare_model():
|
|
37 |
|
38 |
@st.experimental_singleton
|
39 |
def prepare_lists():
|
|
|
|
|
40 |
countries = pd.read_csv("Assets/Countries/combined-countries.csv")
|
41 |
professions = pd.read_csv("Assets/Professions/soc-professions-2018.csv")
|
42 |
word_lists = [list(countries.Words),list(professions.Words)]
|
@@ -303,15 +303,15 @@ if layout == 'VizNLC':
|
|
303 |
if alt_choice == "Similarity":
|
304 |
text2, text3 = get_min_max(cf_df, option)
|
305 |
col2.caption(f"This sentence is 'similar' to {option}.")
|
306 |
-
col3.caption(f"This
|
307 |
elif alt_choice == "Sampling (Random)":
|
308 |
text2, text3 = sampled_alts(cf_df, option)
|
309 |
col2.caption(f"This sentence is a random sample from the alternatives.")
|
310 |
-
col3.caption(f"This
|
311 |
elif alt_choice == "Sampling (Fixed)":
|
312 |
text2, text3 = sampled_alts(cf_df, option, fixed=True)
|
313 |
col2.caption(f"This sentence is a fixed sample of the alternatives.")
|
314 |
-
col3.caption(f"This
|
315 |
elif alt_choice == "Probability":
|
316 |
text2, text3 = abs_dif(cf_df, option)
|
317 |
col2.caption(f"This sentence is the closest prediction in the model.")
|
|
|
2 |
import pandas as pd, spacy, nltk, numpy as np
|
3 |
from spacy.matcher import Matcher
|
4 |
nlp = spacy.load("en_core_web_lg")
|
|
|
|
|
5 |
from nltk.corpus import wordnet
|
6 |
|
7 |
#Import the libraries to support the model and predictions.
|
|
|
35 |
|
36 |
@st.experimental_singleton
|
37 |
def prepare_lists():
|
38 |
+
nltk.download('omw-1.4')
|
39 |
+
nltk.download('wordnet')
|
40 |
countries = pd.read_csv("Assets/Countries/combined-countries.csv")
|
41 |
professions = pd.read_csv("Assets/Professions/soc-professions-2018.csv")
|
42 |
word_lists = [list(countries.Words),list(professions.Words)]
|
|
|
303 |
if alt_choice == "Similarity":
|
304 |
text2, text3 = get_min_max(cf_df, option)
|
305 |
col2.caption(f"This sentence is 'similar' to {option}.")
|
306 |
+
col3.caption(f"This graph represents the {len(cf_df)} alternatives to {option}.")
|
307 |
elif alt_choice == "Sampling (Random)":
|
308 |
text2, text3 = sampled_alts(cf_df, option)
|
309 |
col2.caption(f"This sentence is a random sample from the alternatives.")
|
310 |
+
col3.caption(f"This graph represents the {len(cf_df)} alternatives to {option}.")
|
311 |
elif alt_choice == "Sampling (Fixed)":
|
312 |
text2, text3 = sampled_alts(cf_df, option, fixed=True)
|
313 |
col2.caption(f"This sentence is a fixed sample of the alternatives.")
|
314 |
+
col3.caption(f"This graph represents the {len(cf_df)} alternatives to {option}.")
|
315 |
elif alt_choice == "Probability":
|
316 |
text2, text3 = abs_dif(cf_df, option)
|
317 |
col2.caption(f"This sentence is the closest prediction in the model.")
|