Update app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
import gradio as gr
|
2 |
import pickle
|
3 |
-
import sklearn # Ensure
|
4 |
|
5 |
# Load the trained model and vectorizer safely
|
6 |
try:
|
7 |
-
model = pickle.load(open('model.pkl', 'rb')) #
|
8 |
-
vectorizer = pickle.load(open('vectorizer.pkl', 'rb')) #
|
9 |
except Exception as e:
|
10 |
print(f"Error loading model: {e}")
|
11 |
|
@@ -26,5 +26,5 @@ iface = gr.Interface(
|
|
26 |
description="Enter a message to check if it's spam or not."
|
27 |
)
|
28 |
|
29 |
-
# Launch the app
|
30 |
-
iface.launch(
|
|
|
1 |
import gradio as gr
|
2 |
import pickle
|
3 |
+
import sklearn # Ensure scikit-learn is available
|
4 |
|
5 |
# Load the trained model and vectorizer safely
|
6 |
try:
|
7 |
+
model = pickle.load(open('model.pkl', 'rb')) # Ensure model file name is correct
|
8 |
+
vectorizer = pickle.load(open('vectorizer.pkl', 'rb')) # Ensure vectorizer is uploaded
|
9 |
except Exception as e:
|
10 |
print(f"Error loading model: {e}")
|
11 |
|
|
|
26 |
description="Enter a message to check if it's spam or not."
|
27 |
)
|
28 |
|
29 |
+
# Launch the app for Hugging Face Spaces
|
30 |
+
iface.launch(server_name="0.0.0.0")
|