Spaces:
Sleeping
Sleeping
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
# Déployer
|
| 2 |
+
import gradio as gr
|
| 3 |
+
import os
|
| 4 |
+
# Création de blocks
|
| 5 |
+
demo = gr.Blocks(theme= 'shivi/calm_seafoam')
|
| 6 |
+
inputs = [gr.Textbox(label="Text à résumer", lines=6),
|
| 7 |
+
gr.Number(label = 'Longueur Minimale'),
|
| 8 |
+
gr.Number(label = 'Longueur Maximale')]
|
| 9 |
+
summarizer1 = gr.Interface(fn=summarize_func,
|
| 10 |
+
inputs=inputs,
|
| 11 |
+
outputs=[gr.Textbox(label="Résumé", lines=3)],
|
| 12 |
+
title="Text summarization avec bart-large-cnn",
|
| 13 |
+
description="Résumer n'importe quel texte avec bart-large-cnn"
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
inputs1 = [gr.Textbox(label="Text à résumer", lines=6),
|
| 17 |
+
gr.Number(label = 'Longueur Minimal'),
|
| 18 |
+
gr.Number(label= 'Longueur Maximal')]
|
| 19 |
+
|
| 20 |
+
summarizer2 = gr.Interface(fn=summarize_func_1,
|
| 21 |
+
inputs=inputs1,
|
| 22 |
+
outputs=[gr.Textbox(label="Result", lines=3)],
|
| 23 |
+
title="Text summarization avec mT5_multilingual_XLSum",
|
| 24 |
+
description="Résumer n'importe quel texte mT5_multilingual_XLSum"
|
| 25 |
+
)
|
| 26 |
+
|
| 27 |
+
with demo:
|
| 28 |
+
gr.TabbedInterface(
|
| 29 |
+
[summarizer1,
|
| 30 |
+
summarizer2],
|
| 31 |
+
["Summarize avec mT5",
|
| 32 |
+
"Summarize avec bart"],
|
| 33 |
+
)
|
| 34 |
+
|
| 35 |
+
demo.launch()
|