Spaces:
Runtime error
Runtime error
Commit
·
2f444b0
1
Parent(s):
c3412a2
change default to camembert
Browse files
app.py
CHANGED
@@ -80,6 +80,17 @@ class keyWordExtractor():
|
|
80 |
def clear_input():
|
81 |
return ("", "")
|
82 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
83 |
def t5_generate_summary(article_text):
|
84 |
input_ids = t5_tokenizer(
|
85 |
[WHITESPACE_HANDLER(article_text)],
|
@@ -228,11 +239,11 @@ with gr.Blocks() as demo:
|
|
228 |
with gr.Tab("Summarization + Extraction"):
|
229 |
with gr.Row():
|
230 |
with gr.Column():
|
231 |
-
input_models = gr.Dropdown(['
|
232 |
input_article = gr.TextArea(label = 'Article to be summarized')
|
233 |
|
234 |
with gr.Column():
|
235 |
-
summarized_output = gr.TextArea(label= 'Generated
|
236 |
output_keyword = gr.Textbox(label="Top 3 keywords")
|
237 |
output_proper_nouns = gr.Textbox(label="Proper Nouns")
|
238 |
|
|
|
80 |
def clear_input():
|
81 |
return ("", "")
|
82 |
|
83 |
+
|
84 |
+
def camembert_generate_summary(article_text):
|
85 |
+
inputs = cmb_tokenizer([article_text], padding="max_length", truncation=True,
|
86 |
+
max_length=250,
|
87 |
+
return_tensors="pt")
|
88 |
+
input_ids = inputs.input_ids.to(device)
|
89 |
+
attention_mask = inputs.attention_mask.to(device)
|
90 |
+
output = cmb_model.generate(input_ids, attention_mask=attention_mask)
|
91 |
+
return cmb_tokenizer.decode(output[0], skip_special_tokens=True)
|
92 |
+
|
93 |
+
|
94 |
def t5_generate_summary(article_text):
|
95 |
input_ids = t5_tokenizer(
|
96 |
[WHITESPACE_HANDLER(article_text)],
|
|
|
239 |
with gr.Tab("Summarization + Extraction"):
|
240 |
with gr.Row():
|
241 |
with gr.Column():
|
242 |
+
input_models = gr.Dropdown(['camembert'], value = 'camembert')
|
243 |
input_article = gr.TextArea(label = 'Article to be summarized')
|
244 |
|
245 |
with gr.Column():
|
246 |
+
summarized_output = gr.TextArea(label= 'Generated summary')
|
247 |
output_keyword = gr.Textbox(label="Top 3 keywords")
|
248 |
output_proper_nouns = gr.Textbox(label="Proper Nouns")
|
249 |
|