Spaces:
Configuration error
Configuration error
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,19 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
from agent import classify_emoji_text
|
3 |
+
|
4 |
+
st.set_page_config(page_title="Emoji Offensive Classifier", page_icon="🤖")
|
5 |
+
st.title("🧠 Emoji Offensive Text Detector")
|
6 |
+
|
7 |
+
st.markdown("Enter a sentence containing emoji and check if it’s offensive.")
|
8 |
+
|
9 |
+
example = "你是🐷"
|
10 |
+
text = st.text_area("Enter text:", value=example, height=100)
|
11 |
+
|
12 |
+
if st.button("Analyze"):
|
13 |
+
with st.spinner("Processing..."):
|
14 |
+
translated, label, score = classify_emoji_text(text)
|
15 |
+
st.markdown(f"**Translated Text:** `{translated}`")
|
16 |
+
st.markdown(f"**Prediction:** `{label}`")
|
17 |
+
st.markdown(f"**Confidence:** `{score:.2%}`")
|
18 |
+
else:
|
19 |
+
st.info("Click the button to start analysis.")
|