import pandas as pd from fastai.text.all import * from datasets import load_dataset try: import transformers except ImportError: os.system('pip install transformers') import transformers from transformers import pipeline import gradio as gr #repo_id = "maviced/practica7-1" #learn = from_pretrained_fastai(repo_id) #model = learn.model #model = model.cpu() #repo_id = "maviced/practica7-2" #learn = from_pretrained_fastai(repo_id) #model = learn.model #model = model.cpu() classifier = pipeline('text-classification', model='maviced/clasificador-rotten-tomatoes') def predict(text): #pred,pred_idx,probs = model.predict(text) #return pred return classifier(text)[0]['label'] gr.Interface(fn=predict, inputs="text", outputs="text",examples=['A visually stunning and emotionally resonant film that leaves a lasting impact.', 'The film, while visually stunning, falls short with a predictable plot and underdeveloped characters, leaving the audience craving more substance.']).launch(share=True)