Spaces:
Runtime error
Runtime error
Commit
·
6ee4162
1
Parent(s):
903a7c4
Update app.py
Browse files
app.py
CHANGED
|
@@ -24,23 +24,13 @@ 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(
|
| 28 |
print('Using model {}\n'.format(model_name))
|
| 29 |
|
| 30 |
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
bert_legal_model(content)
|
| 35 |
-
|
| 36 |
-
summary = bert_legal_model(content, min_length = 8, ratio = 0.05)
|
| 37 |
-
# summary = tokenizer_t5.decode(summary_ids[0], skip_special_tokens=True)
|
| 38 |
-
print("Summary:")
|
| 39 |
-
print(summary)
|
| 40 |
-
all_text = str(summary)
|
| 41 |
-
|
| 42 |
-
return all_text
|
| 43 |
-
|
| 44 |
iface = gr.Interface(
|
| 45 |
lincoln,
|
| 46 |
"text",
|
|
|
|
| 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 |
+
def lincoln(input_text):
|
| 32 |
+
output_text= bert_legal_model(input_text, min_length = 8, ratio = 0.05)
|
| 33 |
+
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 34 |
iface = gr.Interface(
|
| 35 |
lincoln,
|
| 36 |
"text",
|