kaushikbar commited on
Commit
b3a537f
1 Parent(s): d151332

added explain

Browse files
Files changed (2) hide show
  1. app.py +9 -7
  2. requirements.txt +0 -1
app.py CHANGED
@@ -8,11 +8,11 @@ from transformers_interpret import ZeroShotClassificationExplainer
8
  import string, nltk
9
 
10
  models = {'en': 'microsoft/deberta-xlarge-mnli', #'Narsil/deberta-large-mnli-zero-cls', # English
11
- 'de': 'Sahajtomar/German_Zeroshot', # German
12
- 'es': 'Recognai/zeroshot_selectra_medium', # Spanish
13
- 'it': 'joeddav/xlm-roberta-large-xnli', # Italian
14
- 'ru': 'DeepPavlov/xlm-roberta-large-en-ru-mnli', # Russian
15
- 'tr': 'vicgalle/xlm-roberta-large-xnli-anli', # Turkish
16
  'no': 'NbAiLab/nb-bert-base-mnli'} # Norsk
17
 
18
  hypothesis_templates = {'en': 'This example is {}.', # English
@@ -25,6 +25,7 @@ hypothesis_templates = {'en': 'This example is {}.', # English
25
 
26
  classifiers = {'en': pipeline("zero-shot-classification", hypothesis_template=hypothesis_templates['en'],
27
  model=models['en']),
 
28
  'de': pipeline("zero-shot-classification", hypothesis_template=hypothesis_templates['de'],
29
  model=models['de']),
30
  'es': pipeline("zero-shot-classification", hypothesis_template=hypothesis_templates['es'],
@@ -35,14 +36,15 @@ classifiers = {'en': pipeline("zero-shot-classification", hypothesis_template=hy
35
  model=models['ru']),
36
  'tr': pipeline("zero-shot-classification", hypothesis_template=hypothesis_templates['tr'],
37
  model=models['tr']),
 
38
  'no': pipeline("zero-shot-classification", hypothesis_template=hypothesis_templates['no'],
39
  model=models['no'])}
40
 
41
  fasttext_model = fasttext.load_model(hf_hub_download("julien-c/fasttext-language-id", "lid.176.bin"))
42
 
43
  _ = nltk.download('stopwords', quiet=True)
44
- _ = nltk.download('wordnet', quiet=True)
45
- _ = nltk.download('punkt', quiet=True)
46
 
47
  def prep_examples():
48
  example_text1 = "Coronavirus disease (COVID-19) is an infectious disease caused by the SARS-CoV-2 virus. Most \
 
8
  import string, nltk
9
 
10
  models = {'en': 'microsoft/deberta-xlarge-mnli', #'Narsil/deberta-large-mnli-zero-cls', # English
11
+ #'de': 'Sahajtomar/German_Zeroshot', # German
12
+ #'es': 'Recognai/zeroshot_selectra_medium', # Spanish
13
+ #'it': 'joeddav/xlm-roberta-large-xnli', # Italian
14
+ #'ru': 'DeepPavlov/xlm-roberta-large-en-ru-mnli', # Russian
15
+ #'tr': 'vicgalle/xlm-roberta-large-xnli-anli', # Turkish
16
  'no': 'NbAiLab/nb-bert-base-mnli'} # Norsk
17
 
18
  hypothesis_templates = {'en': 'This example is {}.', # English
 
25
 
26
  classifiers = {'en': pipeline("zero-shot-classification", hypothesis_template=hypothesis_templates['en'],
27
  model=models['en']),
28
+ '''
29
  'de': pipeline("zero-shot-classification", hypothesis_template=hypothesis_templates['de'],
30
  model=models['de']),
31
  'es': pipeline("zero-shot-classification", hypothesis_template=hypothesis_templates['es'],
 
36
  model=models['ru']),
37
  'tr': pipeline("zero-shot-classification", hypothesis_template=hypothesis_templates['tr'],
38
  model=models['tr']),
39
+ '''
40
  'no': pipeline("zero-shot-classification", hypothesis_template=hypothesis_templates['no'],
41
  model=models['no'])}
42
 
43
  fasttext_model = fasttext.load_model(hf_hub_download("julien-c/fasttext-language-id", "lid.176.bin"))
44
 
45
  _ = nltk.download('stopwords', quiet=True)
46
+ #_ = nltk.download('wordnet', quiet=True)
47
+ #_ = nltk.download('punkt', quiet=True)
48
 
49
  def prep_examples():
50
  example_text1 = "Coronavirus disease (COVID-19) is an infectious disease caused by the SARS-CoV-2 virus. Most \
requirements.txt CHANGED
@@ -1,5 +1,4 @@
1
  transformers
2
- sentence-transformers
3
  torch
4
  langdetect
5
  fasttext
 
1
  transformers
 
2
  torch
3
  langdetect
4
  fasttext