Spaces:
Runtime error
Runtime error
Commit
·
9d89cb5
1
Parent(s):
3bfa56b
Update app.py
Browse files
app.py
CHANGED
@@ -16,18 +16,19 @@ from transformers import pipelines
|
|
16 |
nltk.download('punkt')
|
17 |
|
18 |
|
19 |
-
model_name = 'nlpaueb/legal-bert-base-uncased'
|
20 |
-
|
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 |
-
|
29 |
|
30 |
def get_response(input_text):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
31 |
output_text= bert_legal_model(input_text, min_length = 8, ratio = 0.05)
|
32 |
return output_text
|
33 |
|
|
|
16 |
nltk.download('punkt')
|
17 |
|
18 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
19 |
|
20 |
def get_response(input_text):
|
21 |
+
model_name = 'nlpaueb/legal-bert-base-uncased'
|
22 |
+
|
23 |
+
|
24 |
+
# The setup of huggingface.co
|
25 |
+
custom_config = AutoConfig.from_pretrained(model_name)
|
26 |
+
custom_config.output_hidden_states=True
|
27 |
+
custom_tokenizer = AutoTokenizer.from_pretrained(model_name)
|
28 |
+
custom_model = AutoModel.from_pretrained(model_name, config=custom_config)
|
29 |
+
bert_legal_model = Summarizer(custom_model=custom_model, custom_tokenizer=custom_tokenizer)
|
30 |
+
|
31 |
+
|
32 |
output_text= bert_legal_model(input_text, min_length = 8, ratio = 0.05)
|
33 |
return output_text
|
34 |
|