import gradio as gr # from transformers import pipeline def greet(name): return "Hello " + name + "!!" # classifier = pipeline("sentiment-analysis") # classifier( # [ # "I've been waiting for a HuggingFace course my whole life.", # "I hate this so much!", # ] # ) iface = gr.Interface(fn=greet, inputs="text", outputs="text") iface.launch() # import torch # from transformers import AutoTokenizer, AutoModelForSequenceClassification # checkpoint = "distilbert-base-uncased-finetuned-sst-2-english" # tokenizer = AutoTokenizer.from_pretrained(checkpoint) # model = AutoModelForSequenceClassification.from_pretrained(checkpoint) # sequences = ["I've been waiting for a HuggingFace course my whole life.", "So have I!"] # tokens = tokenizer(sequences, padding=True, truncation=True, return_tensors="pt") # output = model(**tokens)