Spaces:
Sleeping
Sleeping
Download app.py from Mbegali/Sentiment_Analysis: direct link, hf CLI and curl.
- Browser
- Download file 449 Bytes
-
https://huggingface.co/spaces/Mbegali/Sentiment_Analysis/resolve/main/app.py
- Command line
-
hf download hf://spaces/Mbegali/Sentiment_Analysis/app.py
-
curl -L -o app.py https://huggingface.co/spaces/Mbegali/Sentiment_Analysis/resolve/main/app.py
449 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| sentiment = pipeline("sentiment-analysis") | |
| def get_sentiment(input_text): | |
| return sentiment (input_text) | |
| result = get_sentiment(" the movie was very bad") | |
| result | |
| [{'label': 'NEGATIVE', 'score': 0.9997990727424622}] | |
| iface = gr.Interface(fn = get_sentiment, inputs = 'text', outputs = ['text'],title = 'Sentiment Analysis', description= 'get sentiment positive/negative') | |
| iface.launch() | |