Upload 6 files
Browse files- app.py +54 -54
- hate_speech_model.h5 +2 -2
- tokenizer.json +0 -0
app.py
CHANGED
|
@@ -1,54 +1,54 @@
|
|
| 1 |
-
import streamlit as st
|
| 2 |
-
from main import get_result
|
| 3 |
-
|
| 4 |
-
def app():
|
| 5 |
-
if 'user_input' not in st.session_state:
|
| 6 |
-
st.session_state.user_input = ""
|
| 7 |
-
|
| 8 |
-
st.title("Tweet Classification")
|
| 9 |
-
|
| 10 |
-
user_input = st.text_input(
|
| 11 |
-
"Enter a Tweet for Classification:",
|
| 12 |
-
value=st.session_state.user_input,
|
| 13 |
-
key="input_box"
|
| 14 |
-
)
|
| 15 |
-
st.session_state.user_input = user_input
|
| 16 |
-
|
| 17 |
-
st.subheader("Examples:")
|
| 18 |
-
|
| 19 |
-
example1 = "
|
| 20 |
-
example2 = "
|
| 21 |
-
example3 = "I Hate #$%#$%Jewish%$#@%^^@#"
|
| 22 |
-
example4 = "
|
| 23 |
-
|
| 24 |
-
col1, col2 = st.columns(2)
|
| 25 |
-
with col1:
|
| 26 |
-
if st.button(example1[:40] + "..."):
|
| 27 |
-
st.session_state.user_input = example1
|
| 28 |
-
with col2:
|
| 29 |
-
if st.button(example2[:40] + "..."):
|
| 30 |
-
st.session_state.user_input = example2
|
| 31 |
-
|
| 32 |
-
st.write("\n")
|
| 33 |
-
|
| 34 |
-
col1, col2 = st.columns(2)
|
| 35 |
-
with col1:
|
| 36 |
-
if st.button(example3[:40] + "..."):
|
| 37 |
-
st.session_state.user_input = example3
|
| 38 |
-
with col2:
|
| 39 |
-
if st.button(example4[:40] + "..."):
|
| 40 |
-
st.session_state.user_input = example4
|
| 41 |
-
|
| 42 |
-
st.write("\n")
|
| 43 |
-
submit_button = st.button("Submit")
|
| 44 |
-
|
| 45 |
-
if submit_button:
|
| 46 |
-
if user_input.strip():
|
| 47 |
-
result = get_result(user_input)
|
| 48 |
-
st.
|
| 49 |
-
|
| 50 |
-
|
| 51 |
-
|
| 52 |
-
|
| 53 |
-
|
| 54 |
-
|
|
|
|
| 1 |
+
import streamlit as st
|
| 2 |
+
from main import get_result
|
| 3 |
+
|
| 4 |
+
def app():
|
| 5 |
+
if 'user_input' not in st.session_state:
|
| 6 |
+
st.session_state.user_input = ""
|
| 7 |
+
|
| 8 |
+
st.title("Tweet Classification")
|
| 9 |
+
|
| 10 |
+
user_input = st.text_input(
|
| 11 |
+
"Enter a Tweet for Classification:",
|
| 12 |
+
value=st.session_state.user_input,
|
| 13 |
+
key="input_box"
|
| 14 |
+
)
|
| 15 |
+
st.session_state.user_input = user_input
|
| 16 |
+
|
| 17 |
+
st.subheader("Examples:")
|
| 18 |
+
|
| 19 |
+
example1 = "You done a great job my friend!"
|
| 20 |
+
example2 = "I love machine learning"
|
| 21 |
+
example3 = "I Hate #$%#$%Jewish%$#@%^^@#"
|
| 22 |
+
example4 = "what the fuck is happening here"
|
| 23 |
+
|
| 24 |
+
col1, col2 = st.columns(2)
|
| 25 |
+
with col1:
|
| 26 |
+
if st.button(example1[:40] + "..."):
|
| 27 |
+
st.session_state.user_input = example1
|
| 28 |
+
with col2:
|
| 29 |
+
if st.button(example2[:40] + "..."):
|
| 30 |
+
st.session_state.user_input = example2
|
| 31 |
+
|
| 32 |
+
st.write("\n")
|
| 33 |
+
|
| 34 |
+
col1, col2 = st.columns(2)
|
| 35 |
+
with col1:
|
| 36 |
+
if st.button(example3[:40] + "..."):
|
| 37 |
+
st.session_state.user_input = example3
|
| 38 |
+
with col2:
|
| 39 |
+
if st.button(example4[:40] + "..."):
|
| 40 |
+
st.session_state.user_input = example4
|
| 41 |
+
|
| 42 |
+
st.write("\n")
|
| 43 |
+
submit_button = st.button("Submit")
|
| 44 |
+
|
| 45 |
+
if submit_button:
|
| 46 |
+
if user_input.strip():
|
| 47 |
+
result = get_result(user_input)
|
| 48 |
+
st.write(f"**Predicted Data:** {result}")
|
| 49 |
+
st.markdown(f'<p style="font-size: 20px; color: #FF6347; font-weight: bold;">Predicted Data: {result}</p>', unsafe_allow_html=True)
|
| 50 |
+
else:
|
| 51 |
+
st.warning("Please enter some text to classify.")
|
| 52 |
+
|
| 53 |
+
if __name__ == "__main__":
|
| 54 |
+
app()
|
hate_speech_model.h5
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
-
oid sha256:
|
| 3 |
-
size
|
|
|
|
| 1 |
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:b342d428aef894a8962d58be66c3c368964a340431db56ec48f433e94f0a118e
|
| 3 |
+
size 29807064
|
tokenizer.json
CHANGED
|
The diff for this file is too large to render.
See raw diff
|
|
|