Spaces:
Build error
Build error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
from transformers import pipeline
|
| 3 |
+
|
| 4 |
+
summarizer = pipeline("summarization", model="sumedh/t5-base-amazonreviews")
|
| 5 |
+
|
| 6 |
+
def texto_sum(text):
|
| 7 |
+
summary = summarizer(text, do_sample=False)
|
| 8 |
+
return summary[0]['summary_text']
|
| 9 |
+
|
| 10 |
+
demo = gr.Interface(
|
| 11 |
+
fn=texto_sum,
|
| 12 |
+
inputs=gr.Textbox(label="Texto a introducir:", placeholder="Introduce el texto a resumir aquí..."),
|
| 13 |
+
outputs="text"
|
| 14 |
+
)
|
| 15 |
+
|
| 16 |
+
demo.launch()
|