vhpvmx commited on
Commit
89c2a39
1 Parent(s): 6364e0a

actualizando app.py

Browse files
Files changed (1) hide show
  1. app.py +23 -4
app.py CHANGED
@@ -1,7 +1,26 @@
1
  import gradio as gr
 
2
 
3
- def greet(name):
4
- return "Hello " + name + "!!"
5
 
6
- iface = gr.Interface(fn=greet, inputs="text", outputs="text")
7
- iface.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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()