Skip to content

Commit

Permalink
fix: deploy api type (#100)
Browse files Browse the repository at this point in the history
* Update deploy_api.py

* fix api docs

* fix
  • Loading branch information
Zeyi-Lin authored Sep 11, 2024
1 parent 4837ef7 commit 6d9fcaa
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 27 deletions.
16 changes: 8 additions & 8 deletions deploy_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@ def numpy_2_base64(img: np.ndarray):
@app.post("/idphoto")
async def idphoto_inference(
input_image: UploadFile,
height: str = Form(...),
width: str = Form(...),
height: int = Form(413),
width: int = Form(295),
human_matting_model: str = Form("hivision_modnet"),
face_detect_model: str = Form("mtcnn"),
head_measure_ratio=0.2,
head_height_ratio=0.45,
top_distance_max=0.12,
top_distance_min=0.10,
head_measure_ratio: float = 0.2,
head_height_ratio: float = 0.45,
top_distance_max: float = 0.12,
top_distance_min: float = 0.10,
):

image_bytes = await input_image.read()
Expand Down Expand Up @@ -101,7 +101,7 @@ async def idphoto_inference(
async def photo_add_background(
input_image: UploadFile,
color: str = Form(...),
kb: str = Form(None),
kb: int = Form(None),
render: int = Form(0),
):
render_choice = ["pure_color", "updown_gradient", "center_gradient"]
Expand Down Expand Up @@ -147,7 +147,7 @@ async def generate_layout_photos(
input_image: UploadFile,
height: str = Form(...),
width: str = Form(...),
kb: str = Form(None),
kb: int = Form(None),
):
# try:
image_bytes = await input_image.read()
Expand Down
8 changes: 4 additions & 4 deletions docs/api_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ cURL 是一个命令行工具,用于使用各种网络协议传输数据。以

```bash
curl -X POST "http://127.0.0.1:8080/idphoto" \
-F "input_image=@demo/images/test.jpg" \
-F "input_image=@demo/images/test0.jpg" \
-F "height=413" \
-F "width=295" \
-F "human_matting_model=hivision_modnet" \
Expand Down Expand Up @@ -99,7 +99,7 @@ curl -X POST "http://127.0.0.1:8080/generate_layout_photos" \

```bash
curl -X POST "http://127.0.0.1:8080/human_matting" \
-F "input_image=@demo/images/test.jpg" \
-F "input_image=@demo/images/test0.jpg" \
-F "human_matting_model=hivision_modnet"
```

Expand All @@ -115,7 +115,7 @@ curl -X POST "http://127.0.0.1:8080/human_matting" \
import requests

url = "http://127.0.0.1:8080/idphoto"
input_image_path = "images/test.jpg"
input_image_path = "demo/images/test0.jpg"

files = {"input_image": open(input_image_path, "rb")}
data = {"height": 413, "width": 295, "human_matting_model": "hivision_modnet", "face_detect_model": "mtcnn"}
Expand Down Expand Up @@ -509,7 +509,7 @@ async function uploadImage(inputImagePath) {
}

// 示例调用
uploadImage("demo/images/test.jpg").then(response => {
uploadImage("demo/images/test0.jpg").then(response => {
console.log(response);
});
```
10 changes: 5 additions & 5 deletions docs/api_EN.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ cURL is a command-line tool for transferring data using various network protocol

```bash
curl -X POST "http://127.0.0.1:8080/idphoto" \
-F "input_image=@demo/images/test.jpg" \
-F "input_image=@demo/images/test0.jpg" \
-F "height=413" \
-F "width=295" \
-F "human_matting_model=hivision_modnet" \
Expand Down Expand Up @@ -99,7 +99,7 @@ curl -X POST "http://127.0.0.1:8080/generate_layout_photos" \

```bash
curl -X POST "http://127.0.0.1:8080/human_matting" \
-F "input_image=@demo/images/test.jpg" \
-F "input_image=@demo/images/test0.jpg" \
-F "human_matting_model=hivision_modnet"
```

Expand All @@ -115,7 +115,7 @@ curl -X POST "http://127.0.0.1:8080/human_matting" \
import requests

url = "http://127.0.0.1:8080/idphoto"
input_image_path = "images/test.jpg"
input_image_path = "images/test0.jpg"

files = {"input_image": open(input_image_path, "rb")}
data = {"height": 413, "width": 295, "human_matting_model": "hivision_modnet", "face_detect_model": "mtcnn"}
Expand Down Expand Up @@ -430,7 +430,7 @@ async function generateIdPhoto(inputImagePath, height, width) {
}

// Example call
generateIdPhoto("images/test.jpg", 413, 295).then(response => {
generateIdPhoto("images/test0.jpg", 413, 295).then(response => {
console.log(response);
});
```
Expand Down Expand Up @@ -507,7 +507,7 @@ async function uploadImage(inputImagePath) {
}

// Example call
uploadImage("demo/images/test.jpg").then(response => {
uploadImage("demo/images/test0.jpg").then(response => {
console.log(response);
});
```
10 changes: 5 additions & 5 deletions docs/api_JP.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ cURLは、さまざまなネットワークプロトコルを使用してデー

```bash
curl -X POST "http://127.0.0.1:8080/idphoto" \
-F "input_image=@demo/images/test.jpg" \
-F "input_image=@demo/images/test0.jpg" \
-F "height=413" \
-F "width=295" \
-F "human_matting_model=hivision_modnet" \
Expand Down Expand Up @@ -98,7 +98,7 @@ curl -X POST "http://127.0.0.1:8080/generate_layout_photos" \

```bash
curl -X POST "http://127.0.0.1:8080/human_matting" \
-F "input_image=@demo/images/test.jpg" \
-F "input_image=@demo/images/test0.jpg" \
-F "human_matting_model=hivision_modnet"
```

Expand All @@ -114,7 +114,7 @@ curl -X POST "http://127.0.0.1:8080/human_matting" \
import requests

url = "http://127.0.0.1:8080/idphoto"
input_image_path = "images/test.jpg"
input_image_path = "images/test0.jpg"

files = {"input_image": open(input_image_path, "rb")}
data = {"height": 413, "width": 295, "human_matting_model": "hivision_modnet", "face_detect_model": "mtcnn"}
Expand Down Expand Up @@ -430,7 +430,7 @@ async function generateIdPhoto(inputImagePath, height, width) {
}

// サンプル呼び出し
generateIdPhoto("images/test.jpg", 413, 295).then(response => {
generateIdPhoto("images/test0.jpg", 413, 295).then(response => {
console.log(response);
});
```
Expand Down Expand Up @@ -507,7 +507,7 @@ async function uploadImage(inputImagePath) {
}

// サンプル呼び出し
uploadImage("demo/images/test.jpg").then(response => {
uploadImage("demo/images/test0.jpg").then(response => {
console.log(response);
});
```
10 changes: 5 additions & 5 deletions docs/api_KO.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ cURL은 다양한 네트워크 프로토콜을 사용하여 데이터를 전송

```bash
curl -X POST "http://127.0.0.1:8080/idphoto" \
-F "input_image=@demo/images/test.jpg" \
-F "input_image=@demo/images/test0.jpg" \
-F "height=413" \
-F "width=295" \
-F "human_matting_model=hivision_modnet" \
Expand Down Expand Up @@ -99,7 +99,7 @@ curl -X POST "http://127.0.0.1:8080/generate_layout_photos" \

```bash
curl -X POST "http://127.0.0.1:8080/human_matting" \
-F "input_image=@demo/images/test.jpg" \
-F "input_image=@demo/images/test0.jpg" \
-F "human_matting_model=hivision_modnet"
```

Expand All @@ -115,7 +115,7 @@ curl -X POST "http://127.0.0.1:8080/human_matting" \
import requests

url = "http://127.0.0.1:8080/idphoto"
input_image_path = "images/test.jpg"
input_image_path = "images/test0.jpg"

files = {"input_image": open(input_image_path, "rb")}
data = {"height": 413, "width": 295, "human_matting_model": "hivision_modnet", "face_detect_model": "mtcnn"}
Expand Down Expand Up @@ -432,7 +432,7 @@ async function generateIdPhoto(inputImagePath, height, width) {
}

// 예시 호출
generateIdPhoto("images/test.jpg", 413, 295).then(response => {
generateIdPhoto("images/test0.jpg", 413, 295).then(response => {
console.log(response);
});
```
Expand Down Expand Up @@ -509,7 +509,7 @@ async function uploadImage(inputImagePath) {
}

// 예시 호출
uploadImage("demo/images/test.jpg").then(response => {
uploadImage("demo/images/test0.jpg").then(response => {
console.log(response);
});
```

0 comments on commit 6d9fcaa

Please sign in to comment.