Spaces:
Runtime error
Runtime error
actualizando app.py
Browse files
app.py
CHANGED
@@ -1,7 +1,26 @@
|
|
1 |
import gradio as gr
|
|
|
2 |
|
3 |
-
def greet(name):
|
4 |
-
return "Hello " + name + "!!"
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import gradio as gr
|
2 |
+
from transformers import pipeline
|
3 |
|
|
|
|
|
4 |
|
5 |
+
#api = gr.Interface.load("huggingface/EleutherAI/gpt-j-6B")
|
6 |
+
#api = gr.Interface.load("./models/mt5-small-finetuned-amazon-en-es")
|
7 |
+
#api = gr.Interface.load("huggingface/vhpvmx/mt5-small-finetuned-amazon-en-es") #ESTE LO CARGA
|
8 |
+
|
9 |
+
hub_model_id = "vhpvmx/mt5-small-finetuned-amazon-en-es"
|
10 |
+
summarizer = pipeline("summarization", model=hub_model_id)
|
11 |
+
|
12 |
+
#model="./models/mt5-small-finetuned-amazon-en-es"
|
13 |
+
#summarizer = pipeline("summarization", model)
|
14 |
+
|
15 |
+
def summary(text):
|
16 |
+
return summarizer(text)[0]["summary_text"]
|
17 |
+
|
18 |
+
|
19 |
+
with gr.Blocks() as demo:
|
20 |
+
input_text = gr.Textbox(placeholder="Ingresa la reseña del libro...", lines=4)
|
21 |
+
output_text = gr.Textbox(label="Resumen")
|
22 |
+
btn = gr.Button("Genera el resumen")
|
23 |
+
|
24 |
+
btn.click(summary, input_text, output_text)
|
25 |
+
|
26 |
+
demo.launch()
|