File size: 786 Bytes
a12f8eb
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
import gradio as gr
from transformers import pipeline

# repo_id = "YOUR_USERNAME/YOUR_LEARNER_NAME"
repo_id = "luisvarona/clasificador-trek"
resumidor = pipeline('text2text-generation', model='luisvarona/modelo_resumen')

# Definimos una función que se encarga de llevar a cabo las predicciones
def predict(str):
    # dic_label_score = classifier(str)[0]
    # label = dic_label_score['label']
    # score = dic_label_score['score']
    # dicc = {'LABEL_0': 'ABBR', 'LABEL_1': 'ENTY', 'LABEL_2': 'DESC', 'LABEL_3': 'HUM', 'LABEL_4': 'LOC', 'LABEL_5': 'NUM'}
    # label = dicc[label]
    return resumidor(str)
    
# Creamos la interfaz y la lanzamos. 
gr.Interface(fn=predict, inputs="textbox", outputs="textbox", examples=['How old are you?','What time is it?']).launch(share=True)