clone3 commited on
Commit
cdfb88f
·
verified ·
1 Parent(s): f548caf

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +10 -2
app.py CHANGED
@@ -2,6 +2,7 @@ import os
2
  import json
3
  import shutil
4
  import tempfile
 
5
  from datetime import datetime
6
  from flask import Flask, request, jsonify
7
  from huggingface_hub import login, HfApi
@@ -69,5 +70,12 @@ def upload_image():
69
  except Exception as e:
70
  return jsonify({"error": str(e)}), 500
71
 
72
- if __name__ == '__main__':
73
- app.run(host='0.0.0.0', port=7860)
 
 
 
 
 
 
 
 
2
  import json
3
  import shutil
4
  import tempfile
5
+ import uvicorn
6
  from datetime import datetime
7
  from flask import Flask, request, jsonify
8
  from huggingface_hub import login, HfApi
 
70
  except Exception as e:
71
  return jsonify({"error": str(e)}), 500
72
 
73
+ def start_server(port: int = 7860):
74
+ uvicorn.run(
75
+ "app:app",
76
+ host="0.0.0.0",
77
+ port=port,
78
+ )
79
+
80
+ if __name__ == "__main__":
81
+ start_server()