File size: 407 Bytes
1800e31 |
1 2 3 4 5 6 7 8 9 10 11 12 13 |
import gradio as gr
from transformers import pipeline
pipe = pipeline("text-classification", model="TheBritishLibrary/bl-books-genre")
def puntuacion_sentimientos (texto):
resultado = pipe (texto)
print (resultado)
etiqueta = resultado[0]["label"]
print(texto+': '+etiqueta)
return etiqueta
demo = gr.Interface(fn=puntuacion_sentimientos, inputs="text", outputs="text")
demo. launch () |