fix: deploy api type (#100)

* Update deploy_api.py

* fix api docs

* fix
This commit is contained in:
Ze-Yi LIN
2024-09-11 14:02:55 +08:00
committed by GitHub
parent 4837ef7dd0
commit 6d9fcaad97
5 changed files with 27 additions and 27 deletions
+8 -8
View File
@@ -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()
@@ -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"]
@@ -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()
+4 -4
View File
@@ -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" \
@@ -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"
```
@@ -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"}
@@ -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);
});
```
+5 -5
View File
@@ -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" \
@@ -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"
```
@@ -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"}
@@ -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);
});
```
@@ -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);
});
```
+5 -5
View File
@@ -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" \
@@ -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"
```
@@ -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"}
@@ -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);
});
```
@@ -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);
});
```
+5 -5
View File
@@ -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" \
@@ -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"
```
@@ -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"}
@@ -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);
});
```
@@ -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);
});
```