Spaces:
Sleeping
Sleeping
JKJanosko
commited on
Commit
•
811ee7c
1
Parent(s):
feb6d3e
Add files via upload
Browse files- AppDirectory/Dockerfile +19 -0
- AppDirectory/app.py +27 -0
- AppDirectory/requirements.txt +0 -0
AppDirectory/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"]
|
AppDirectory/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","Here is a default string. I love machine learning!")
|
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()
|
AppDirectory/requirements.txt
ADDED
Binary file (112 Bytes). View file
|
|