JollypopChannel commited on
Commit
c9f3392
1 Parent(s): e2d11b2

put download model up top

Browse files
Files changed (1) hide show
  1. model.py +19 -16
model.py CHANGED
@@ -1,3 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
  def model(passage, level):
2
  # pip install spacy
3
  # pip install transformers
@@ -7,16 +26,6 @@ def model(passage, level):
7
  # pip install spacy-download
8
  # pip install nltk
9
 
10
- # Importing libraries
11
- from nltk.corpus import wordnet
12
- import spacy
13
- import nltk
14
- import transformers
15
- import pandas as pd
16
- import json
17
- import random
18
- import torch
19
-
20
  nltk.download('wordnet')
21
  nltk.download('omw-1.4')
22
 
@@ -48,9 +57,6 @@ def model(passage, level):
48
  else:
49
  txt = txt
50
 
51
- # Part Of Speech tagging (POS tagging)
52
- nlp = spacy.load("en_core_web_sm")
53
-
54
  text_dict = {}
55
  for n in txt:
56
  n = n.strip()
@@ -140,10 +146,7 @@ def model(passage, level):
140
  # if torch.cuda.is_available():
141
  # device=0
142
  # else:
143
- device='cpu'
144
 
145
- # Declare the (trained) model that will be used
146
- classifier = transformers.pipeline("zero-shot-classification", model="simple_trained_wsd_pipeline", device=device)
147
 
148
  # Process Python dictionary, def_filtered
149
  correct_def = {}
 
1
+ # Importing libraries
2
+ from nltk.corpus import wordnet
3
+ import nltk
4
+ import transformers
5
+ import pandas as pd
6
+ import json
7
+ import random
8
+ import torch
9
+
10
+ device='cpu'
11
+
12
+ # Declare the (trained) model that will be used
13
+ classifier = transformers.pipeline("zero-shot-classification", model="simple_trained_wsd_pipeline", device=device)
14
+
15
+ import spacy
16
+ # Part Of Speech tagging (POS tagging)
17
+ nlp = spacy.load("en_core_web_sm")
18
+
19
+
20
  def model(passage, level):
21
  # pip install spacy
22
  # pip install transformers
 
26
  # pip install spacy-download
27
  # pip install nltk
28
 
 
 
 
 
 
 
 
 
 
 
29
  nltk.download('wordnet')
30
  nltk.download('omw-1.4')
31
 
 
57
  else:
58
  txt = txt
59
 
 
 
 
60
  text_dict = {}
61
  for n in txt:
62
  n = n.strip()
 
146
  # if torch.cuda.is_available():
147
  # device=0
148
  # else:
 
149
 
 
 
150
 
151
  # Process Python dictionary, def_filtered
152
  correct_def = {}