Skip to content

Instantly share code, notes, and snippets.

@devmnj
Last active October 28, 2024 14:55
Show Gist options
  • Save devmnj/1bf4e2deebc21506c76d895e5d84bbd5 to your computer and use it in GitHub Desktop.
Save devmnj/1bf4e2deebc21506c76d895e5d84bbd5 to your computer and use it in GitHub Desktop.
Use hugging face models in Colab
//authenticate hf with token
import huggingface_hub
huggingface_hub.login()
//Use the model
sentiment_pipeline = pipeline("sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english")
result = sentiment_pipeline("Tesla's latest earnings report exceeded expectations, leading to a surge in stock price.")
print(result)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment