32 lines
994 B
Python
32 lines
994 B
Python
import requests
|
|
import json
|
|
import os
|
|
import time
|
|
|
|
API_URL = "http://127.0.0.1:7000/translate_images"
|
|
IMG_DIR = "/home/ckh08045/work/IT_Server/modules/img"
|
|
|
|
# img 폴더의 모든 이미지 파일 리스트업
|
|
image_files = [os.path.join(IMG_DIR, f) for f in os.listdir(IMG_DIR)
|
|
if f.lower().endswith((".jpg", ".jpeg", ".png", ".bmp", ".gif", ".webp", ".tif", ".tiff"))]
|
|
|
|
payload = {
|
|
"local_image_paths": image_files,
|
|
"file_prefix": "multi",
|
|
"toggle_states": {"ocr": True},
|
|
"unwanted_texts": {"크리스탈": "크리미", "세탁기": "이미지삭제"},
|
|
"watermark_text": "테스트 워터마크",
|
|
"watermark_opacity": 0.5,
|
|
"watermark_font_size": 32
|
|
}
|
|
|
|
headers = {"Content-Type": "application/json"}
|
|
|
|
start = time.time()
|
|
response = requests.post(API_URL, data=json.dumps(payload), headers=headers)
|
|
elapsed = time.time() - start
|
|
|
|
print("응답 결과:")
|
|
print(response.status_code)
|
|
print(response.json())
|
|
print(f"총 소요 시간: {elapsed:.2f}초") |