Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -53,6 +53,16 @@ def predict_email(email):
|
|
53 |
prediction = obj.predict(data)[0]
|
54 |
st.write(f"Prediction: {prediction}")
|
55 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
56 |
|
57 |
if st.button("Predict Email"):
|
58 |
if email_input:
|
|
|
53 |
prediction = obj.predict(data)[0]
|
54 |
st.write(f"Prediction: {prediction}")
|
55 |
|
56 |
+
@app.get("/predict/")
|
57 |
+
def predict_spam(email: str):
|
58 |
+
"""
|
59 |
+
This endpoint predicts whether the email is Spam or Ham.
|
60 |
+
Query parameter: email (str) - The email text to be classified.
|
61 |
+
"""
|
62 |
+
data = bow.transform([email]).toarray()
|
63 |
+
prediction = obj.predict(data)[0]
|
64 |
+
return JSONResponse(content={"prediction": prediction})
|
65 |
+
|
66 |
|
67 |
if st.button("Predict Email"):
|
68 |
if email_input:
|