JKJanosko commited on
Commit
262808a
2 Parent(s): bf81a44 f831f0c

Merge pull request #2 from JKJanosko/milestone-2

Browse files
Files changed (4) hide show
  1. MS2/Dockerfile +19 -0
  2. MS2/app.py +27 -0
  3. MS2/requirements.txt +0 -0
  4. README.md +7 -0
MS2/Dockerfile ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ FROM python:3.9
2
+
3
+ RUN pip install -U pip
4
+
5
+ WORKDIR /app
6
+
7
+
8
+ RUN pip freeze > requirements.txt
9
+
10
+ COPY requirements.txt /requirements.txt
11
+
12
+ RUN pip install -r /requirements.txt
13
+
14
+
15
+ EXPOSE 8501
16
+
17
+ COPY . /app
18
+
19
+ ENTRYPOINT ["python","-m","streamlit", "run", "app.py"]
MS2/app.py ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import streamlit as st
2
+ from transformers import pipeline
3
+ import torch
4
+ import torch.nn.functional as F
5
+
6
+ def main():
7
+
8
+ 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"]
9
+
10
+ st.title("Streamlit Sentiment Analysis App ")
11
+ st.header("Sentiments analysis using Trnasformers by 🤗")
12
+ st.header("Jozef Janosko - CS 482, Milestone 2")
13
+
14
+ st.text("Input a test string for sentiment analysis.")
15
+ input=st.text_input("input string")
16
+ model = st.selectbox("Select Model...", models)
17
+ st.text("Result using "+model+": ")
18
+ st.text(str(sentiment_Analysis(input,model)))
19
+
20
+ def sentiment_Analysis(input, model):
21
+
22
+ classifier = pipeline("sentiment-analysis",model)
23
+ ret=classifier(input)
24
+ return ret
25
+
26
+ if __name__ == '__main__' :
27
+ main()
MS2/requirements.txt ADDED
Binary file (112 Bytes). View file
 
README.md CHANGED
@@ -1,3 +1,10 @@
 
 
 
 
 
 
 
1
  # cs482 Milestone 1
2
  ## Jozef Janosko
3
 
 
1
+ # cs482 Milestone 2
2
+ ## Jozef Janosko
3
+
4
+ ###Link to Text classification app in streamlit, deployed on 🤗 spaces
5
+ [Link to Hugginface spaces](https://huggingface.co/spaces/JKJanosko/Milestone2-SentimentAnalysis)
6
+
7
+
8
  # cs482 Milestone 1
9
  ## Jozef Janosko
10