JKJanosko
Add files via upload
811ee7c unverified
raw
history blame
1.13 kB
import streamlit as st
from transformers import pipeline
import torch
import torch.nn.functional as F
def main():
models = ["distilbert-base-uncased-finetuned-sst-2-english","cardiffnlp/twitter-roberta-base-sentiment","finiteautomata/bertweet-base-sentiment-analysis","papluca/xlm-roberta-base-language-detection","cardiffnlp/twitter-roberta-base-sentiment-latest","yiyanghkust/finbert-tone","ProsusAI/finbert","j-hartmann/emotion-english-distilroberta-base"]
st.title("Streamlit Sentiment Analysis App ")
st.header("Sentiments analysis using Trnasformers by 🤗")
st.header("Jozef Janosko - CS 482, Milestone 2")
st.text("Input a test string for sentiment analysis.")
input=st.text_input("input string","Here is a default string. I love machine learning!")
model = st.selectbox("Select Model...", models)
st.text("Result using "+model+": ")
st.text(str(sentiment_Analysis(input,model)))
def sentiment_Analysis(input, model):
classifier = pipeline("sentiment-analysis",model)
ret=classifier(input)
return ret
if __name__ == '__main__' :
main()