import gradio as gr from transformers import pipeline classifier3 = pipeline('text-classification', model='nlmaldonadog/clasificador-rotten-tomatoes-bert-base-uncased') classifier4 = pipeline('text-classification', model='nlmaldonadog/clasificador-rotten-tomatoes-xlnet-base-cased') def val_label(lab): if lab == "LABEL_1": return "Positive" return "Negative" def predict(text): m3 = classifier3(text)[0] prediction = f"Model 3: {val_label(m3['label'])} with {m3['score']} of confidence.\nModel 4: {val_label(m4['label'])} with {m4['score']} of confidence." return prediction ifg = gr.Interface(fn=predict, inputs=[gr.Textbox(placeholder='Escribe aquĆ­...')], outputs="text") ifg.launch(share=True)