debjani31 commited on
Commit
28b132c
·
1 Parent(s): 055ef56

Fix: Change port to 7860 for Hugging Face Spaces

Browse files
Files changed (2) hide show
  1. Dockerfile +1 -1
  2. app.py +3 -2
Dockerfile CHANGED
@@ -21,7 +21,7 @@ COPY mnist_cnn_model.h5 .
21
  COPY website/ ./website/
22
 
23
  # Expose port
24
- EXPOSE 5000
25
 
26
  # Run the Flask app
27
  CMD ["python", "app.py"]
 
21
  COPY website/ ./website/
22
 
23
  # Expose port
24
+ EXPOSE 7860
25
 
26
  # Run the Flask app
27
  CMD ["python", "app.py"]
app.py CHANGED
@@ -370,5 +370,6 @@ def serve_files(filename):
370
  if __name__ == '__main__':
371
  if model is None:
372
  print("⚠ Warning: Model could not be loaded. Predictions will fail.")
373
- print("🚀 Starting DigitVision server on http://0.0.0.0:5000")
374
- app.run(host='0.0.0.0', port=5000, debug=False)
 
 
370
  if __name__ == '__main__':
371
  if model is None:
372
  print("⚠ Warning: Model could not be loaded. Predictions will fail.")
373
+ port = int(os.environ.get('PORT', 7860))
374
+ print(f"🚀 Starting DigitVision server on http://0.0.0.0:{port}")
375
+ app.run(host='0.0.0.0', port=port, debug=False)