Spaces:
Sleeping
Sleeping
Upload app.py
Browse files
app.py
ADDED
@@ -0,0 +1,21 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
import streamlit as st
|
2 |
+
import pickle
|
3 |
+
|
4 |
+
with open("jailbreak_detector.pkl", "rb") as f:
|
5 |
+
model = pickle.load(f)
|
6 |
+
|
7 |
+
# Streamlit UI
|
8 |
+
st.title("🚨 LLM Jailbreak Detector")
|
9 |
+
st.write("Enter a prompt to check if it's **safe** or a **jailbreak attempt**.")
|
10 |
+
|
11 |
+
user_input = st.text_area("Enter Prompt Here:", "")
|
12 |
+
|
13 |
+
if st.button("Check Prompt"):
|
14 |
+
if user_input:
|
15 |
+
prediction = model.predict([user_input])[0]
|
16 |
+
if prediction == "safe":
|
17 |
+
st.success("✅ This is a **safe** prompt.")
|
18 |
+
else:
|
19 |
+
st.error("⚠️ This is a **jailbreak attempt!**")
|
20 |
+
else:
|
21 |
+
st.warning("Please enter a prompt first.")
|