Spaces:
Sleeping
Sleeping
Kingston Yip
commited on
Commit
·
7f81307
1
Parent(s):
7179214
apptest;
Browse files
app.py
CHANGED
@@ -1,47 +1,47 @@
|
|
1 |
-
import streamlit as st
|
2 |
-
from transformers import pipeline
|
3 |
-
from PIL import Image
|
4 |
|
5 |
-
pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
|
6 |
|
7 |
-
st.title("Hot Dog? Or Not?")
|
8 |
|
9 |
-
file_name = st.file_uploader("Upload a hot dog candidate image")
|
10 |
|
11 |
-
if file_name is not None:
|
12 |
-
|
13 |
|
14 |
-
|
15 |
-
|
16 |
-
|
17 |
|
18 |
-
|
19 |
-
|
20 |
-
|
21 |
|
22 |
|
23 |
-
|
24 |
-
|
25 |
|
26 |
|
27 |
-
|
28 |
-
|
29 |
|
30 |
-
|
31 |
|
32 |
-
|
33 |
|
34 |
-
|
35 |
-
|
36 |
-
|
37 |
-
|
38 |
-
|
39 |
-
|
40 |
|
41 |
-
|
42 |
|
43 |
-
|
44 |
-
|
45 |
-
|
46 |
|
47 |
|
|
|
1 |
+
# import streamlit as st
|
2 |
+
# from transformers import pipeline
|
3 |
+
# from PIL import Image
|
4 |
|
5 |
+
# pipeline = pipeline(task="image-classification", model="julien-c/hotdog-not-hotdog")
|
6 |
|
7 |
+
# st.title("Hot Dog? Or Not?")
|
8 |
|
9 |
+
# file_name = st.file_uploader("Upload a hot dog candidate image")
|
10 |
|
11 |
+
# if file_name is not None:
|
12 |
+
# col1, col2 = st.columns(2)
|
13 |
|
14 |
+
# image = Image.open(file_name)
|
15 |
+
# col1.image(image, use_column_width=True)
|
16 |
+
# predictions = pipeline(image)
|
17 |
|
18 |
+
# col2.header("Probabilities")
|
19 |
+
# for p in predictions:
|
20 |
+
# col2.subheader(f"{ p['label'] }: { round(p['score'] * 100, 1)}%")
|
21 |
|
22 |
|
23 |
+
import streamlit as st
|
24 |
+
from transformers import pipeline
|
25 |
|
26 |
|
27 |
+
pipe = pipeline(task="sentiment-analysis")
|
28 |
+
st.title("Toxic Tweets Analyzer")
|
29 |
|
30 |
+
text = st.text_area("Enter your tweet here, or submit to test the default tweets")
|
31 |
|
32 |
+
if text == "Enter your tweet here, or submit to test the default tweets":
|
33 |
|
34 |
+
data = [
|
35 |
+
"PICKLE YE",
|
36 |
+
"I'm nice at ping pong"
|
37 |
+
"My eyes are now wide open and now realize I've been used to spread messages I don't believe in. I am distancing myself from politics and completely focusing on being creative !!!",
|
38 |
+
"There are so many lonely emojis",
|
39 |
+
]
|
40 |
|
41 |
+
st.json([pipe(d) for d in data])
|
42 |
|
43 |
+
else:
|
44 |
+
out = pipe(text)
|
45 |
+
st.json(out)
|
46 |
|
47 |
|