Spaces:
Sleeping
Sleeping
Download app.py from lokeshnaik33339/Sentiment_Analysis: direct link, hf CLI and curl.
- Browser
- Download file 552 Bytes
-
https://huggingface.co/spaces/lokeshnaik33339/Sentiment_Analysis/resolve/main/app.py
- Command line
-
hf download hf://spaces/lokeshnaik33339/Sentiment_Analysis/app.py
-
curl -L -o app.py https://huggingface.co/spaces/lokeshnaik33339/Sentiment_Analysis/resolve/main/app.py
552 Bytes
| import gradio as gr | |
| from transformers import pipeline | |
| # Load the sentiment analysis pipeline | |
| nlp = pipeline("sentiment-analysis") | |
| # Define the function for sentiment analysis | |
| def analyze_sentiment(text): | |
| result = nlp(text) | |
| return result | |
| # Create the Gradio interface | |
| iface = gr.Interface( | |
| fn=analyze_sentiment, | |
| inputs="text", | |
| outputs="text", | |
| title="Sentiment Analysis", | |
| description="Enter a sentence to analyze its sentiment." | |
| ) | |
| # Launch the Gradio app | |
| if __name__ == "__main__": | |
| iface.launch(debug=True,share=True) | |