yusufgundogdu commited on
Commit
863df0e
·
verified ·
1 Parent(s): b04da03

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +6 -9
app.py CHANGED
@@ -1,21 +1,18 @@
1
  from flask import Flask, jsonify
 
2
 
3
  app = Flask(__name__)
4
 
5
- # Memory optimizasyonu için basit route'lar
6
  @app.route('/')
7
  def home():
8
- return jsonify({"status": "active", "app": "stablediffusionapi"})
9
 
10
  @app.route('/health')
11
  def health():
12
  return jsonify({"status": "healthy"})
13
 
14
- # Basit API endpoint
15
- @app.route('/generate', methods=['POST'])
16
- def generate():
17
- return jsonify({"message": "API ready", "status": "success"})
18
-
19
  if __name__ == '__main__':
20
- # Production'da 0.0.0.0 ve port 8080 kullan
21
- app.run(host='0.0.0.0', port=8080, threaded=True, debug=False)
 
1
  from flask import Flask, jsonify
2
+ import os
3
 
4
  app = Flask(__name__)
5
 
6
+ # Hugging Face'in health check endpointi
7
  @app.route('/')
8
  def home():
9
+ return jsonify({"status": "ready", "framework": "Flask"})
10
 
11
  @app.route('/health')
12
  def health():
13
  return jsonify({"status": "healthy"})
14
 
15
+ # Hugging Face'in özel port ayarı
 
 
 
 
16
  if __name__ == '__main__':
17
+ port = int(os.environ.get('PORT', 8080))
18
+ app.run(host='0.0.0.0', port=port, threaded=True, debug=False)