Maulidaaa commited on
Commit
b9449ed
·
verified ·
1 Parent(s): fd57e1e

Upload 4 files

Browse files
Files changed (4) hide show
  1. Dockerfile +24 -0
  2. app.py +22 -0
  3. best (2).pt +3 -0
  4. requirements.txt +6 -0
Dockerfile ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Gunakan base image Python
2
+ FROM python:3.10-slim
3
+
4
+ # Install dependency sistem yang dibutuhkan (OpenCV, PIL, Ultralytics)
5
+ RUN apt-get update && apt-get install -y \
6
+ git \
7
+ ffmpeg \
8
+ libsm6 \
9
+ libxext6 \
10
+ libgl1-mesa-glx \
11
+ && rm -rf /var/lib/apt/lists/*
12
+
13
+ # Buat working directory
14
+ WORKDIR /app
15
+
16
+ # Copy semua file ke container
17
+ COPY . /app
18
+
19
+ # Install dependency Python
20
+ RUN pip install --no-cache-dir --upgrade pip
21
+ RUN pip install --no-cache-dir -r requirements.txt
22
+
23
+ # Jalankan server Flask
24
+ CMD ["python", "app.py"]
app.py ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ from flask import Flask, request, jsonify
2
+ from detector.gesture_detector import detect_gesture
3
+
4
+ app = Flask(__name__)
5
+
6
+ @app.route("/detect", methods=["POST"])
7
+ def detect():
8
+ if "image" not in request.files:
9
+ return jsonify({"error": "No image"}), 400
10
+
11
+ file = request.files["image"]
12
+ result = detect_gesture(file)
13
+
14
+ return jsonify({
15
+ # "image_base64": result["image_base64"],
16
+ "saved_to": result["saved_to"],
17
+ "detections": result["detections"],
18
+ "total_detections": result["total_detections"]
19
+ })
20
+
21
+ if __name__ == "__main__":
22
+ app.run(host="0.0.0.0", port=5000)
best (2).pt ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:5e8d22a0c8d45a320e75d0c5af20411133291bc20e0aca536986c02138f1ba09
3
+ size 22536803
requirements.txt ADDED
@@ -0,0 +1,6 @@
 
 
 
 
 
 
 
1
+ flask==3.0.0
2
+ flask-cors==4.0.0
3
+ ultralytics==8.0.196
4
+ opencv-python==4.8.1.78
5
+ pillow==10.0.1
6
+ numpy==1.24.3