Practica_8 / app.py
luisvarona's picture
Create app.py
a12f8eb verified
raw
history blame
786 Bytes
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)