Spaces:
Sleeping
Sleeping
Fix: Change port to 7860 for Hugging Face Spaces
Browse files- Dockerfile +1 -1
- 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
|
| 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 |
-
|
| 374 |
-
|
|
|
|
|
|
| 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)
|