Spaces:
Configuration error
Configuration error
mariaoliv
commited on
Commit
•
6480255
1
Parent(s):
57ddb6a
beep boop
Browse files- Dockerfile +2 -0
- app.py +23 -1
Dockerfile
CHANGED
@@ -5,4 +5,6 @@ RUN pip install pandas
|
|
5 |
RUN pip install numpy
|
6 |
RUN pip install tensorflow
|
7 |
RUN pip install transformers
|
|
|
|
|
8 |
CMD ["python", "./app.py"]
|
|
|
5 |
RUN pip install numpy
|
6 |
RUN pip install tensorflow
|
7 |
RUN pip install transformers
|
8 |
+
RUN pip install streamlit
|
9 |
+
RUN pip install --default-timeout=100000 torch
|
10 |
CMD ["python", "./app.py"]
|
app.py
CHANGED
@@ -1,3 +1,25 @@
|
|
1 |
import numpy as np
|
|
|
2 |
from transformers import pipeline
|
3 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import numpy as np
|
2 |
+
import pandas as pd
|
3 |
from transformers import pipeline
|
4 |
+
from transformers import AutoTokenizer, TFAutoModelForSequenceClassification
|
5 |
+
import streamlit as st
|
6 |
+
|
7 |
+
classifier = pipeline("sentiment-analysis")
|
8 |
+
|
9 |
+
model_name ="distilbert-base-uncased-finetuned-sst-2-english"
|
10 |
+
|
11 |
+
tokenizer = AutoTokenizer.from_pretrained(model_name)
|
12 |
+
model = TFAutoModelForSequenceClassification.from_pretrained(model_name)
|
13 |
+
|
14 |
+
classifier = pipeline("sentiment-analysis", model=model, tokenizer=tokenizer)
|
15 |
+
|
16 |
+
|
17 |
+
print(classifier("Thanks a lot for watching the video. Really appreciate it"))
|
18 |
+
|
19 |
+
st.title("Sentiment Analysis of a Tweet")
|
20 |
+
tweet = st.text_input(label="Tweet Text")
|
21 |
+
|
22 |
+
|
23 |
+
if(st.button("Analyze")):
|
24 |
+
sentiment = classifier(tweet)
|
25 |
+
st.write(sentiment[0]['label'])
|