Spaces:
Runtime error
Runtime error
arithescientist
commited on
Commit
·
6ebd1a5
1
Parent(s):
6ac7a93
Update app.py
Browse files
app.py
CHANGED
@@ -12,17 +12,21 @@ import pdfkit
|
|
12 |
import yake
|
13 |
from summarizer import Summarizer,TransformerSummarizer
|
14 |
from transformers import pipelines
|
15 |
-
|
16 |
-
|
17 |
from transformers import AutoTokenizer, AutoModelForPreTraining
|
|
|
18 |
model_name = 'nlpaueb/legal-bert-base-uncased'
|
|
|
|
|
19 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
20 |
|
21 |
-
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
22 |
-
|
23 |
-
model = AutoModelForPreTraining.from_pretrained(model_name)
|
24 |
-
bert_legal_model = Summarizer(custom_model=model, custom_tokenizer=tokenizer)
|
25 |
-
|
26 |
|
27 |
|
28 |
def get_response(input_text):
|
|
|
12 |
import yake
|
13 |
from summarizer import Summarizer,TransformerSummarizer
|
14 |
from transformers import pipelines
|
15 |
+
nltk.download('punkt')
|
|
|
16 |
from transformers import AutoTokenizer, AutoModelForPreTraining
|
17 |
+
# model_name = 'distilbert-base-uncased'
|
18 |
model_name = 'nlpaueb/legal-bert-base-uncased'
|
19 |
+
#model_name = 'laxya007/gpt2_legal'
|
20 |
+
# model_name = 'facebook/bart-large-cnn'
|
21 |
|
22 |
+
# The setup of huggingface.co
|
23 |
+
custom_config = AutoConfig.from_pretrained(model_name)
|
24 |
+
custom_config.output_hidden_states=True
|
25 |
+
custom_tokenizer = AutoTokenizer.from_pretrained(model_name)
|
26 |
+
custom_model = AutoModel.from_pretrained(model_name, config=custom_config)
|
27 |
+
bert_legal_model = Summarizer(custom_model=custom_model, custom_tokenizer=custom_tokenizer)
|
28 |
+
print('Using model {}\n'.format(model_name))
|
29 |
|
|
|
|
|
|
|
|
|
|
|
30 |
|
31 |
|
32 |
def get_response(input_text):
|