import numpy as np import os import gradio as gr os.environ["WANDB_DISABLED"] = "true" from datasets import load_dataset, load_metric from transformers import ( AutoConfig, # AutoModelForSequenceClassification, AutoTokenizer, TrainingArguments, logging, pipeline ) # model_name = # tokenizer = AutoTokenizer.from_pretrained(model_name) # config = AutoConfig.from_pretrained(model_name) # pipe = pipeline("text-classification") # pipe("This restaurant is awesome") # Question answering pipeline, specifying the checkpoint identifier # model = AutoModelForSequenceClassification.from_pretrained( # pretrained_model_name_or_path= "thak123/Cro-Frida", # num_labels=3, # ) analyzer = pipeline( "sentiment-analysis", model="thak123/Cro-Frida", tokenizer="EMBEDDIA/crosloengual-bert" ) def predict_sentiment(x): return analyzer(x) interface = gr.Interface( fn=predict_sentiment, inputs='text', outputs=['label'], title='Croatian Movie reviews Sentiment Analysis', examples= ["Es mīlu Tevi","Es ienīstu kafiju"], description='Get the positive/neutral/negative sentiment for the given input.' ) interface.launch(inline = False)