jayn95 commited on
Commit
a2418a8
·
verified ·
1 Parent(s): f522fb1

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +5 -4
app.py CHANGED
@@ -1,6 +1,7 @@
1
  from flask import Flask, request, jsonify
2
  from gradio_client import Client, handle_file
3
  import tempfile, base64, os, threading
 
4
 
5
  from flask_cors import CORS # ✅ allow mobile apps to call this API
6
 
@@ -126,7 +127,7 @@ def predict_periodontitis():
126
  return jsonify({"error": str(e)}), 500
127
 
128
 
129
- # Use the port Render provides (via $PORT env var)
130
- if __name__ == "__main__":
131
- port = int(os.environ.get("PORT", 10000))
132
- app.run(host="0.0.0.0", port=port)
 
1
  from flask import Flask, request, jsonify
2
  from gradio_client import Client, handle_file
3
  import tempfile, base64, os, threading
4
+ from huggingface_hub import InferenceClient
5
 
6
  from flask_cors import CORS # ✅ allow mobile apps to call this API
7
 
 
127
  return jsonify({"error": str(e)}), 500
128
 
129
 
130
+ # 🚀 Required function for Hugging Face Spaces
131
+ def start():
132
+ # HF Spaces automatically assigns host/port
133
+ app.run()