Sentiment analysis example¶
In this example, you learn how to use the DistilBERT model trained by HuggingFace using PyTorch. You can provide the model with a question and a paragraph containing an answer. The model is then able to find the best answer from the answer paragraph. You can find the source code in SentimentAnalysis.java.
Input text for analysis
I like DJL. DJL is the best DL framework!
[ class: "Positive", probability: 0.99864 class: "Negative", probability: 0.00135 ]
Follow setup to configure your development environment.
cd examples ./gradlew run -Dai.djl.default_engine=PyTorch -Dmain=ai.djl.examples.inference.SentimentAnalysis