Spaces:
Runtime error
Runtime error
Kewl
commited on
Commit
•
7f33f1a
1
Parent(s):
2d413de
Milestone 2 (#4)
Browse files* merge (#3)
* Create main.yml
* Update main.yml
* Update main.yml
* Update main.yml
* adding sentiment analysis for dummy text
- app.py +15 -6
- requirements.txt +3 -3
app.py
CHANGED
@@ -1,7 +1,16 @@
|
|
1 |
-
import
|
2 |
-
|
3 |
-
from PIL import Image #Image Processing
|
4 |
-
import numpy as np #Image Processing
|
5 |
|
6 |
-
|
7 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from transformers import pipeline
|
|
|
|
|
3 |
|
4 |
+
classifier = pipeline(task="sentiment-analysis")
|
5 |
+
|
6 |
+
st.title("Sentiment Analysis App")
|
7 |
+
|
8 |
+
POSITIVE = "You are a great person!"
|
9 |
+
NEGATIVE = "You are a terrible person!"
|
10 |
+
|
11 |
+
st.caption(POSITIVE)
|
12 |
+
if st.button("Get sentiment", key=1):
|
13 |
+
st.write(classifier(POSITIVE)[0]['label'])
|
14 |
+
st.caption(NEGATIVE)
|
15 |
+
if st.button("Get sentiment", key=2):
|
16 |
+
st.write(classifier(NEGATIVE)[0]['label'])
|
requirements.txt
CHANGED
@@ -1,5 +1,5 @@
|
|
1 |
streamlit
|
2 |
-
opencv-python-headless
|
3 |
numpy
|
4 |
-
|
5 |
-
|
|
|
|
1 |
streamlit
|
|
|
2 |
numpy
|
3 |
+
transformers
|
4 |
+
datasets
|
5 |
+
tensorflow==1.8.0
|