Muhammad-Arham commited on
Commit
8463dbe
·
verified ·
1 Parent(s): c53d270

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +4 -4
app.py CHANGED
@@ -4,8 +4,8 @@ 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,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 for Hugging Face Spaces
30
- iface.launch(server_name="0.0.0.0")
 
4
 
5
  # Load the trained model and vectorizer safely
6
  try:
7
+ model = pickle.load(open('model.pkl', 'rb')) # Ensure correct file name
8
+ vectorizer = pickle.load(open('vectorizer.pkl', 'rb'))
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
+ # Ensure Hugging Face properly serves the app
30
+ iface.launch(server_name="0.0.0.0", server_port=7860, inbrowser=True)