{ "cells": [ { "cell_type": "markdown", "id": "b71a1322", "metadata": {}, "source": [ "# Get started with `tanaos-sentiment-analysis-v1`" ] }, { "cell_type": "markdown", "id": "469712c1", "metadata": {}, "source": [ "## Option 1 - Use through the [Artifex library](https://github.com/tanaos/artifex)" ] }, { "cell_type": "code", "execution_count": null, "id": "c4bfa886", "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [], "source": [ "!pip install artifex" ] }, { "cell_type": "code", "execution_count": null, "id": "7a8f8ec7", "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [], "source": [ "from artifex import Artifex\n", "\n", "sa = Artifex().sentiment_analysis\n", "\n", "very_positive_label = sa(\"It was exceptional. One of the best meals I have ever had.\")\n", "very_negative_label = sa(\"The movie was just awful and painfully predictable.\")\n", "\n", "print(very_positive_label)\n", "print(very_negative_label)" ] }, { "cell_type": "markdown", "id": "afcc6d57", "metadata": {}, "source": [ "## Option 2 - Use through the Transformers library" ] }, { "cell_type": "code", "execution_count": null, "id": "ff2b44c9", "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [], "source": [ "!pip install transformers" ] }, { "cell_type": "code", "execution_count": null, "id": "ae5368d6", "metadata": { "vscode": { "languageId": "plaintext" } }, "outputs": [], "source": [ "from transformers import pipeline\n", "\n", "clf = pipeline(\"text-classification\", model=\"tanaos/tanaos-sentiment-analysis-v1\")\n", "\n", "very_positive_label = clf(\"It was exceptional. One of the best meals I have ever had.\")\n", "very_negative_label = clf(\"The movie was just awful and painfully predictable.\")\n", "\n", "print(very_positive_label)\n", "print(very_negative_label)" ] } ], "metadata": { "language_info": { "name": "python" } }, "nbformat": 4, "nbformat_minor": 5 }