Update app.py
Browse files
app.py
CHANGED
@@ -29,7 +29,6 @@ st.set_page_config(page_title="Emoji Offensive Text Detector", page_icon="🚨",
|
|
29 |
# ✅ 侧边栏: 选择模型
|
30 |
with st.sidebar:
|
31 |
st.header("🧠 Settings")
|
32 |
-
moderation_type = st.selectbox("Select Task Type", ["Normal Text", "Bullet Screen Text"])
|
33 |
selected_model = st.selectbox("Choose classification model", list(model_options.keys()))
|
34 |
selected_model_id = model_options[selected_model]
|
35 |
classifier = pipeline("text-classification", model=selected_model_id, device=0 if torch.cuda.is_available() else -1)
|
@@ -113,9 +112,24 @@ if st.session_state.history:
|
|
113 |
theta='Category',
|
114 |
line_close=True,
|
115 |
title="⚠️ Risk Radar by Category",
|
116 |
-
color_discrete_sequence=['
|
117 |
template='simple_white'
|
118 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
119 |
st.plotly_chart(radar_fig)
|
120 |
else:
|
121 |
st.info("⚠️ No classification data available yet.")
|
|
|
29 |
# ✅ 侧边栏: 选择模型
|
30 |
with st.sidebar:
|
31 |
st.header("🧠 Settings")
|
|
|
32 |
selected_model = st.selectbox("Choose classification model", list(model_options.keys()))
|
33 |
selected_model_id = model_options[selected_model]
|
34 |
classifier = pipeline("text-classification", model=selected_model_id, device=0 if torch.cuda.is_available() else -1)
|
|
|
112 |
theta='Category',
|
113 |
line_close=True,
|
114 |
title="⚠️ Risk Radar by Category",
|
115 |
+
color_discrete_sequence=['black'],
|
116 |
template='simple_white'
|
117 |
)
|
118 |
+
radar_fig.update_layout(
|
119 |
+
polar=dict(
|
120 |
+
radialaxis=dict(
|
121 |
+
showticklabels=False,
|
122 |
+
ticks='',
|
123 |
+
gridshape='circular'
|
124 |
+
),
|
125 |
+
angularaxis=dict(
|
126 |
+
showticklabels=False,
|
127 |
+
ticks=''
|
128 |
+
)
|
129 |
+
),
|
130 |
+
paper_bgcolor='white',
|
131 |
+
plot_bgcolor='white'
|
132 |
+
)
|
133 |
st.plotly_chart(radar_fig)
|
134 |
else:
|
135 |
st.info("⚠️ No classification data available yet.")
|