Kurumi commited on
Commit ·
62d4cc8
1
Parent(s): 6a9eb2c
feat: use gunicorn
Browse files- Dockerfile +1 -1
- app.py +1 -7
- requirements.txt +3 -1
Dockerfile
CHANGED
|
@@ -8,4 +8,4 @@ RUN chmod -R 777 /app
|
|
| 8 |
|
| 9 |
RUN pip install --break-system-packages --no-cache-dir --requirement requirements.txt
|
| 10 |
|
| 11 |
-
CMD ["
|
|
|
|
| 8 |
|
| 9 |
RUN pip install --break-system-packages --no-cache-dir --requirement requirements.txt
|
| 10 |
|
| 11 |
+
CMD ["gunicorn", "app:app", "--bind", "0.0.0.0:7860", "--worker-class", "gevent"]
|
app.py
CHANGED
|
@@ -11,7 +11,7 @@ from diffusers import AutoPipelineForText2Image
|
|
| 11 |
app = Flask("ImageAPI")
|
| 12 |
|
| 13 |
|
| 14 |
-
@app.
|
| 15 |
def main():
|
| 16 |
prompt = request.args.get("prompt")
|
| 17 |
|
|
@@ -34,9 +34,3 @@ def main():
|
|
| 34 |
path_or_file=BytesIO(image),
|
| 35 |
mimetype="image/png",
|
| 36 |
)
|
| 37 |
-
|
| 38 |
-
|
| 39 |
-
app.run(
|
| 40 |
-
host="localhost",
|
| 41 |
-
port=7860,
|
| 42 |
-
)
|
|
|
|
| 11 |
app = Flask("ImageAPI")
|
| 12 |
|
| 13 |
|
| 14 |
+
@app.route(rule="/", methods=["GET"])
|
| 15 |
def main():
|
| 16 |
prompt = request.args.get("prompt")
|
| 17 |
|
|
|
|
| 34 |
path_or_file=BytesIO(image),
|
| 35 |
mimetype="image/png",
|
| 36 |
)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
requirements.txt
CHANGED
|
@@ -1,2 +1,4 @@
|
|
| 1 |
diffusers
|
| 2 |
-
flask
|
|
|
|
|
|
|
|
|
| 1 |
diffusers
|
| 2 |
+
flask
|
| 3 |
+
gevent
|
| 4 |
+
gunicorn
|