Spaces:
Running
Running
Updating UI and Some fixes
Browse files- app.py +8 -3
- predictor.py +1 -1
app.py
CHANGED
|
@@ -14,6 +14,11 @@ if st.button("Predict"):
|
|
| 14 |
st.warning("Please enter some text to analyze.")
|
| 15 |
else:
|
| 16 |
prediction, confidence = predict_text(text_input)
|
| 17 |
-
|
| 18 |
-
|
| 19 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 14 |
st.warning("Please enter some text to analyze.")
|
| 15 |
else:
|
| 16 |
prediction, confidence = predict_text(text_input)
|
| 17 |
+
|
| 18 |
+
if prediction == 1:
|
| 19 |
+
st.success("**Class**: 🤖 AI-Generated")
|
| 20 |
+
st.info(f"**Confidence**: {confidence * 100:.2f}% (AI)")
|
| 21 |
+
else:
|
| 22 |
+
st.success("**Class**: 🧠 Human-Written")
|
| 23 |
+
st.info(f"**Confidence**: {(1 - confidence) * 100:.2f}% (Human)")
|
| 24 |
+
|
predictor.py
CHANGED
|
@@ -44,5 +44,5 @@ def preprocess_text(text):
|
|
| 44 |
def predict_text(text):
|
| 45 |
X_sample = preprocess_text(text)
|
| 46 |
prediction = model.predict(X_sample)[0]
|
| 47 |
-
confidence = model.predict_proba(X_sample)[
|
| 48 |
return prediction, confidence
|
|
|
|
| 44 |
def predict_text(text):
|
| 45 |
X_sample = preprocess_text(text)
|
| 46 |
prediction = model.predict(X_sample)[0]
|
| 47 |
+
confidence = model.predict_proba(X_sample)[:,1][0]
|
| 48 |
return prediction, confidence
|