diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..e70781f --- /dev/null +++ b/.gitignore @@ -0,0 +1 @@ +__pycache__/main.cpython-311.pyc diff --git a/README.md b/README.md index e69de29..3327044 100644 --- a/README.md +++ b/README.md @@ -0,0 +1,10 @@ +Api to get emotions, age, gender , race and rectangle of face. + +in a Post in http://127.0.0.1:7860/faces/ with a json in body with this format: + +{"path":"data/3.jpg","actions":["age", "gender", "emotion", "race"]} + + +** install + +install requeriments.txt \ No newline at end of file diff --git a/data/1.jpg b/data/1.jpg new file mode 100644 index 0000000..5546b7a Binary files /dev/null and b/data/1.jpg differ diff --git a/data/2.jpg b/data/2.jpg new file mode 100644 index 0000000..9663256 Binary files /dev/null and b/data/2.jpg differ diff --git a/data/3.jpg b/data/3.jpg new file mode 100644 index 0000000..9908dec Binary files /dev/null and b/data/3.jpg differ diff --git a/data/4.jpg b/data/4.jpg new file mode 100644 index 0000000..6915737 Binary files /dev/null and b/data/4.jpg differ diff --git a/data/5.jpg b/data/5.jpg new file mode 100644 index 0000000..0e9049a Binary files /dev/null and b/data/5.jpg differ diff --git a/main.py b/main.py new file mode 100644 index 0000000..d78c536 --- /dev/null +++ b/main.py @@ -0,0 +1,37 @@ +from deepface import DeepFace +from fastapi import FastAPI +from pydantic import BaseModel +from typing import Optional +# objs = DeepFace.analyze(img_path = "data/1.jpg", +# actions = ['age', 'gender', 'race', 'emotion'] +# ) +# print(objs) +# objs = DeepFace.analyze(img_path = "data/2.jpg", +# actions = ['age', 'gender', 'race', 'emotion'] +# ) +# print(objs) +# objs = DeepFace.analyze(img_path = "data/3.jpg", +# actions = ['age', 'gender', 'race', 'emotion'] +# ) +# print(objs) +# objs = DeepFace.analyze(img_path = "data/4.jpg", +# actions = ['age', 'gender', 'race', 'emotion'] +# ) +# print(objs) + +# print(objs) + +class Response(BaseModel): + path: str + actions : Optional[list] = ['age', 'gender', 'race', 'emotion'] +app = FastAPI() +@app.get("/") +def read_main(): + return {"message": "This is your main app"} +@app.post("/faces/") +def calculate_api(response: Response): + path = response.path + actions = response.actions + objs = DeepFace.analyze(img_path =path, + actions = actions) + return objs diff --git a/requeriments.txt b/requeriments.txt new file mode 100644 index 0000000..e72d07f --- /dev/null +++ b/requeriments.txt @@ -0,0 +1,71 @@ +absl-py==2.0.0 +annotated-types==0.6.0 +anyio==3.7.1 +astunparse==1.6.3 +beautifulsoup4==4.12.2 +blinker==1.7.0 +cachetools==5.3.2 +certifi==2023.11.17 +charset-normalizer==3.3.2 +click==8.1.7 +deepface==0.0.80 +Deprecated==1.2.14 +fastapi==0.106.0 +filelock==3.13.1 +fire==0.5.0 +Flask==3.0.0 +flatbuffers==23.5.26 +gast==0.5.4 +gdown==4.7.1 +google-auth==2.25.2 +google-auth-oauthlib==1.2.0 +google-pasta==0.2.0 +grpcio==1.60.0 +gunicorn==21.2.0 +h11==0.14.0 +h5py==3.10.0 +idna==3.6 +itsdangerous==2.1.2 +Jinja2==3.1.2 +keras==2.15.0 +libclang==16.0.6 +Markdown==3.5.1 +MarkupSafe==2.1.3 +ml-dtypes==0.2.0 +mtcnn==0.1.1 +numpy==1.26.2 +oauthlib==3.2.2 +opencv-python==4.8.1.78 +opt-einsum==3.3.0 +packaging==23.2 +pandas==2.1.4 +Pillow==10.1.0 +protobuf==4.23.4 +pyasn1==0.5.1 +pyasn1-modules==0.3.0 +pydantic==2.5.3 +pydantic_core==2.14.6 +PySocks==1.7.1 +python-dateutil==2.8.2 +pytz==2023.3.post1 +requests==2.31.0 +requests-oauthlib==1.3.1 +retina-face==0.0.13 +rsa==4.9 +six==1.16.0 +sniffio==1.3.0 +soupsieve==2.5 +starlette==0.27.0 +tensorboard==2.15.1 +tensorboard-data-server==0.7.2 +tensorflow==2.15.0.post1 +tensorflow-estimator==2.15.0 +tensorflow-io-gcs-filesystem==0.35.0 +termcolor==2.4.0 +tqdm==4.66.1 +typing_extensions==4.9.0 +tzdata==2023.3 +urllib3==2.1.0 +uvicorn==0.25.0 +Werkzeug==3.0.1 +wrapt==1.14.1 diff --git a/run.sh b/run.sh new file mode 100644 index 0000000..0b6293f --- /dev/null +++ b/run.sh @@ -0,0 +1 @@ +uvicorn main:app --reload --port 7860 \ No newline at end of file