Spaces:
Sleeping
Sleeping
Kingston Yip
commited on
Commit
•
3e1c304
1
Parent(s):
37cf69d
updates
Browse files
app.py
CHANGED
@@ -1,25 +1,3 @@
|
|
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 |
|
@@ -27,12 +5,15 @@ from transformers import pipeline
|
|
27 |
pipe = pipeline(task="sentiment-analysis")
|
28 |
st.title("Toxic Tweets Analyzer")
|
29 |
|
30 |
-
|
31 |
-
|
32 |
-
st.form_submit_button(label="Submit")
|
33 |
-
|
34 |
-
if text:
|
35 |
-
out = pipe(text)
|
36 |
-
st.json(out)
|
37 |
|
|
|
|
|
|
|
|
|
|
|
38 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
import streamlit as st
|
2 |
from transformers import pipeline
|
3 |
|
|
|
5 |
pipe = pipeline(task="sentiment-analysis")
|
6 |
st.title("Toxic Tweets Analyzer")
|
7 |
|
8 |
+
#initial
|
9 |
+
text = st.text_area("enter some text")
|
|
|
|
|
|
|
|
|
|
|
10 |
|
11 |
+
#form
|
12 |
+
with st.form("my_form"):
|
13 |
+
submitted = st.form_submit_button("Submit")
|
14 |
+
if submitted:
|
15 |
+
st.write("Form submitted!")
|
16 |
|
17 |
+
if text:
|
18 |
+
out = pipe(text)
|
19 |
+
st.json(out)
|