Spaces:
Runtime error
Runtime error
Download app.py from 640510702phithak/Sentiment-Analysis: direct link, hf CLI and curl.
- Browser
- Download file 580 Bytes
-
https://huggingface.co/spaces/640510702phithak/Sentiment-Analysis/resolve/main/app.py
- Command line
-
hf download hf://spaces/640510702phithak/Sentiment-Analysis/app.py
-
curl -L -o app.py https://huggingface.co/spaces/640510702phithak/Sentiment-Analysis/resolve/main/app.py
580 Bytes
| import torch | |
| import streamlit as st | |
| from transformers import pipeline | |
| title="Sentiment Analysis" | |
| classifier = pipeline(task="sentiment-analysis", | |
| model="distilbert-base-uncased-finetuned-sst-2-english") | |
| def main(): | |
| st.title(title) | |
| with st.form("questionaire"): | |
| prompt1 = st.text_input("your text") | |
| clicked = st.form_submit_button("start") | |
| if clicked: | |
| results=classifier(prompt1) | |
| st.text(results[0]['label']) | |
| st.text(f"Score : {results[0]['score']}") | |
| if __name__=='__main__': | |
| main() | |