Maftuuh1922 commited on
Commit
01bcde7
·
1 Parent(s): 7fdd922

fix: use port 7860 for HF Spaces compatibility

Browse files
Files changed (2) hide show
  1. Dockerfile +6 -6
  2. app.py +1 -1
Dockerfile CHANGED
@@ -20,16 +20,16 @@ RUN pip install --no-cache-dir -r requirements.txt
20
  COPY app.py .
21
  COPY models/ models/
22
 
23
- # Expose port
24
- EXPOSE 5000
25
 
26
  # Set environment variables
27
  ENV FLASK_APP=app.py
28
  ENV PYTHONUNBUFFERED=1
29
 
30
- # Health check
31
  HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
32
- CMD python -c "import requests; requests.get('http://localhost:5000/health')"
33
 
34
- # Run with gunicorn
35
- CMD ["gunicorn", "--bind", "0.0.0.0:5000", "--workers", "2", "--timeout", "120", "app:app"]
 
20
  COPY app.py .
21
  COPY models/ models/
22
 
23
+ # Expose port (HF Spaces expects 7860)
24
+ EXPOSE 7860
25
 
26
  # Set environment variables
27
  ENV FLASK_APP=app.py
28
  ENV PYTHONUNBUFFERED=1
29
 
30
+ # Health check (port 7860 for HF Spaces)
31
  HEALTHCHECK --interval=30s --timeout=10s --start-period=60s --retries=3 \
32
+ CMD python -c "import requests; requests.get('http://localhost:7860/health')"
33
 
34
+ # Run with gunicorn (HF Spaces requires port 7860)
35
+ CMD ["gunicorn", "--bind", "0.0.0.0:7860", "--workers", "2", "--timeout", "120", "app:app"]
app.py CHANGED
@@ -152,4 +152,4 @@ def predict():
152
  return jsonify({"success": False, "error": str(e)}), 500
153
 
154
  if __name__ == '__main__':
155
- app.run(host='0.0.0.0', port=5000)
 
152
  return jsonify({"success": False, "error": str(e)}), 500
153
 
154
  if __name__ == '__main__':
155
+ app.run(host='0.0.0.0', port=7860)