Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
repo_id = "maviced/mbart-samsum"
|
| 5 |
+
summarizer = pipeline('text2text-generation', model=repo_id)
|
| 6 |
+
|
| 7 |
+
def predict(texto):
|
| 8 |
+
return summarizer(texto)
|
| 9 |
+
|
| 10 |
+
texto1 = 'Sophia: ¿Has terminado de leer ese libro? Luis: Sí, lo terminé anoche. Sophia: ¿Qué te pareció? Luis: Fue increíble. Definitivamente lo recomendaría.'
|
| 11 |
+
texto2 = 'Maria: ¿Vas a venir a la fiesta esta noche? Juan: Sí, planeo ir. Maria: ¡Genial! Estoy emocionada de verte allí. Juan: Yo también estoy emocionado de verte. Va a ser una gran noche.'
|
| 12 |
+
|
| 13 |
+
|
| 14 |
+
gr.Interface(fn=predict, inputs="textbox", outputs="textbox", examples=[texto1, texto2]).launch(share=True)
|