DeepAI 도구에 대한 가이드, 참고 자료 및 API 문서
DeepAI에서 제공하는 인공지능 도구를 여기서 살펴보세요
채팅하고, 웹 검색을 하고, 무엇이든 도움을 받으세요
다양한 이미지 생성기를 활용해 멋진 사진을 만들어 보세요
AI 사진 편집기로 나만의 멋진 사진을 편집해 보세요
자신이 가진 사진이나 아이디어를 바탕으로 멋진 동영상을 만들어 보세요
코드를 작성하지 않고도 사이트를 설명하고 구축해 보세요
음악, 배경 제거, 색상 입히기, 업스케일 등
DeepAI Pro의 포함 사항 및 가격
문서를 살펴보고 어떤 API를 제공하는지 확인해 보세요
DeepAI는 다양한 AI 도구가 가득한 환상적인 디지털 공간이에요. 누구나 더 쉽고 편리하게 콘텐츠를 만들 수 있도록 도와드려요! 학교 과제나 업무 프로젝트를 진행 중이든, 단순히 창의적인 아이디어를 실험해 보고 싶든 AI 채팅, AI 이미지 생성, AI 사진 편집기, AI 캐릭터 등 다양한 도구를 사용해 볼 수 있어요. 또한 DeepAI는 이 분야의 최신 동향을 배우고 따라갈 수 있도록 도와주는 다양한 자료도 제공해요.
AI 채팅은 텍스트 프롬프트에 응답하는 어시스턴트예요.
이 기능으로 이야기를 만들거나, 메시지를 작성하거나, 코드를 작성할 수 있어요. 마치 어떤 주제든 이야기할 수 있는 초지능 AI 친구와 대화하는 것 같아요. 첨단 알고리즘을 탑재한 AI 채팅은 다양한 질문을 이해하고, 지식과 추론 능력을 바탕으로 답변해 줘요.
사용하기 편한 음성 대화를 원하시나요? AI 음성 채팅을 이용하면 가능해요! 질문하거나 작업 중인 주제에 대해 상담하는 것부터, 개선하고 싶은 문서를 검토하는 것까지 단 한 글자도 입력하지 않고 모두 처리할 수 있어요.
이 도구는 무료 계정으로 하루 60초 동안 체험해 볼 수 있고, DeepAI Pro 구독을 통해 AI 음성 채팅의 최상위 버전을 이용할 수도 있어요.
Online 검색을 이용하면 웹에서 정보를 찾을 수 있어서, 새로운 것을 배우거나 흥미로운 주제를 발견하는 데 매우 유용해요. 이 모드를 이용하려면 DeepAI 계정에 로그인하세요.
이 모드는 웹을 실시간으로 검색하기에 아주 좋은 선택지예요. 이 모드를 이용하면 시사 이슈나 새롭게 떠오르는 주제에 대해 훨씬 더 포괄적이고 상세한 정보를 찾을 수 있어요.
메모리 도구는 채팅 시스템이 정보를 수집하고, 더 정확한 답변을 위한 기준을 마련하는 데 도움을 줘요. 이전에 공유한 정보를 바탕으로 취향, 선호도, 관심사를 파악해요. 이 모든 정보는 이 옵션을 활성화한 이후 채팅 시스템과 나눈 대화를 기반으로 해요. 채팅 시스템은 이전에 제공한 정보에 접근할 수 있으며, 해당 정보는 옵션이 활성화되어 있고 채팅 기록이 있는 경우에만 이용할 수 있어요. 채팅 기록을 삭제하면 이전 대화 내용은 전혀 반영되지 않아요.
채팅이 실시간으로 웹을 탐색해서, 찾고 있는 내용에 대해 더 정확하고 최신의 정보와 완전한 데이터를 찾아낼 수 있도록 해 보세요.
'이미지 만들기' 도구를 사용하면 현재 사용 중인 채팅 모델(Standard, Genius Pro, Super Genius Pro)에 따라 채팅에서 바로 이미지를 생성할 수 있어요. 생성하고 싶은 내용의 프롬프트만 입력하면 끝이에요!
실생활에서 필요한 일을 채팅에 맡겨 보세요. 일상적인 일을 처리하는 데 큰 도움이 될 수 있어요. 막판에 깜빡하고 사지 못한 물건을 사고 싶으신가요? 항공권 최저가를 찾고 계신가요? 그냥 요청하기만 하면 채팅이 대신 처리해 줘요.
이 버전은 Standard AI 채팅보다 성능이 향상되었고, 더 상세한 응답과 더 뛰어난 지능을 갖추고 있어요.
이 모델은 고도의 추론, 논리적 분석, 수학 문제 해결이 필요한 작업에서 Genius 모드보다 뛰어난 성능을 발휘하도록 설계되었어요. 예상 응답 시간이 약간 더 길 수 있지만, 더 심도 있는 분석과 폭넓은 맥락 이해, 보다 포괄적인 답변을 제공해서 복잡한 작업에서 더 뛰어나고 신뢰할 수 있는 경험을 선사해요.
이 애드온을 사용하면 방정식, 미분, 서술형 문제, 대수학, 미적분학 등 다양한 수학 및 과학 문제를 풀 수 있어요! 이 모드는 전문적인 문제를 풀 때뿐만 아니라, 확실하지 않은 과제를 확인할 때도 매우 유용해요.
AI 이미지 생성기는 텍스트를 바탕으로 이미지를 생성하는 도구로, 인공지능을 활용해 창의력을 발휘하고 작품을 만들어 볼 수 있어요. 꿈꾸는 장소나 원하는 어떤 것이든 이미지를 묘사해 보세요. 나머지는 AI가 알아서 해 줄 거예요!
고품질 이미지를 생성하려면 프롬프트를 선택한 다음, 100가지가 넘는 스타일과 형태 중에서 골라보세요.
더 풍부한 디테일과 더 높은 예술적 완성도, HD보다 지시를 더 잘 따르는 이미지를 원할 때 선택하세요. 최대 1024x1024px 해상도로, 가로, 정사각형 또는 세로 형식으로 활용할 수 있어요.
놀라운 디테일을 자랑하는 초고해상도 2K 이미지를 위한 모드예요. 단순히 실험해 보든, 장대한 작품을 만들고자 하든, 이 도구는 모든 요구에 맞는 모드를 제공해요. 이미지를 인쇄하려는 경우 이 형식이 안성맞춤이에요.
AI 사진 편집기는 원하는 변경 사항을 텍스트로 설명하기만 하면, 새 사진이든 오래된 사진이든 상관없이 창의력을 발휘해 어떤 이미지든 재창조하거나 수정할 수 있게 해주는 도구예요.
이미지나 URL을 업로드하고, 편집하거나 추가하고 싶은 내용을 프롬프트에 입력한 뒤 생성하기만 하면 끝이에요. 최상의 결과를 얻으려면 “하늘을 빨갛게 만들어 주세요”나 “배경에 꽃을 추가해 주세요”와 같이 구체적이고 간결하게 지시해 주세요.
또한 최대 3장의 참조 이미지를 사용해 편집할 수도 있어요. 다음과 같은 예시처럼 지시하면 돼요:
DeepAI의 AI 동영상 생성기는 이미지와 텍스트를 동영상으로 변환해 줘요. 교육용, 오락용 또는 단편 스토리 동영상을 만들 때 활용할 수 있어요.
동영상 생성기에 업로드하면 DeepAI에 해당 이미지와 동영상을 공개적으로 공유할 권한을 부여하게 돼요. 아래 내용을 읽고 작동 방식을 정확히 이해해 주세요.
DeepAI Pro 멤버십에는 매월 25초 분량의 HD 동영상 생성이 포함되어 있어요. 추가 HD 동영상은 초당 $0.20의 요율로 지갑에서 차감돼요. Hollywood 모드(2K 해상도)에는 매월 8초 분량의 동영상이 포함되며, 추가 Hollywood 모드 동영상은 초당 $0.30의 요율로 크레딧에서 차감돼요.
선명한 화질과 섬세한 디테일로 사실적인 일상 물건, 환경 및 일반적인 장면을 생성하도록 설계된 다목적 생성 모드예요. 특히 가전제품, 가구, 침실, 주방, 사무실, 거실 및 일상용품과 같이 실용적이고 친숙한 피사체를 표현하는 데 탁월한 성능을 발휘해요. 초당 0.20달러로 가성비가 가장 뛰어나요.
전문적인 음향과 영상으로 제작된 고품질의 영화 같은 영상. 초당 0.30달러로 최고의 창의적 품질을 경험하세요.
이미지를 참고 자료로 삼아 동영상을 생성할 수 있어요. AI 동영상 생성기는 해당 이미지를 장면의 출발점으로 삼고 프롬프트를 더 잘 이해해서, 입력한 텍스트와 이미지에 최대한 가까운 결과를 만들어 줘요.
프로젝트에 활용하고 싶은 참고 자료가 있나요? 추가하면 AI 동영상 생성기가 프롬프트와 함께 이를 바탕으로 최상의 결과물을 만들어 내요.
인공지능으로 영상을 새롭게 변신시켜 보세요. 간단한 지시만으로도 장면에 요소를 추가하거나 수정, 제거하여 원하는 대로 콘텐츠를 완성할 수 있어요.
Website Builder는 고급 기술 지식이나 코딩 지식이 없어도 웹사이트를 간편하게 제작, 맞춤 설정 및 관리할 수 있도록 설계된 웹 기반 플랫폼이에요.
이 도구는 직관적인 인터페이스와 다양한 구성 가능한 요소를 제공해서, 반응형 웹사이트를 구축하고, 레이아웃과 콘텐츠를 맞춤 설정하며, 페이지를 관리하고, 프로젝트의 시각적 디자인을 조정할 수 있게 해줘요.
저희의 다양한 도구를 하나씩 살펴보세요. 여러분의 지식과 상상력으로 놀라운 결과물을 만들어낼 수 있다는 걸 알게 될 거예요!
DeepAI의 음악 생성기를 이용해 손쉽게 독창적인 음악을 만들어 보세요. 영상용 폴리, 음향 효과, 배경 음악 제작에 안성맞춤이에요. 필요에 맞춰 맞춤 생성된 사운드스케이프로 여러분의 프로젝트를 한층 더 돋보이게 만들어 보세요.
DeepAI Pro를 이용 중이라면 매월 처음 100곡은 무료이고, 그 이후에는 곡당 0.10달러가 부과돼요.
배경을 제거해야 할 이미지가 있거나, 단순히 배경이 마음에 들지 않나요? 이 도구를 사용해 보세요. 아주 손쉽게 배경을 제거해 줘요.
옛날 흑백 사진이 어떻게 보일지 궁금하신가요? 오래된 가족 사진을 추가하여 색을 입혀 생동감 있게 만들어 보세요.
초고해상도 도구는 머신러닝을 활용해 사진의 내용과 고유한 특징을 잃지 않으면서 이미지를 선명하게 하고, 디테일을 살리며, 해상도를 높여줘요. 안타깝게도 흐릿한 이미지는 흔히 발생하며, 전문가와 아마추어 모두에게 골칫거리예요. 초고해상도는 머신러닝 기술을 활용해 단 몇 분의 1초 만에 이미지의 해상도를 높여줘요.
사진 속 어떤 부분이 마음에 들지 않으세요? 이 도구를 사용하면 물체를 쉽게 변경할 수 있어요. 원하는 부분을 정확히 지정하여 이미지를 더 멋지게 다듬을 수 있어요.
이미지가 진짜인지 확신이 서지 않으세요? 이미지를 업로드하면 해당 이미지가 AI로 생성된 것인지, 아니면 디지털로 조작된 것인지 추정해 드려요. 결과는 확률적일 뿐이며, 확실한 증거로 간주해서는 안 돼요.
DeepAI Pro는 월 9.99달러 또는 연 89.99달러에 DeepAI의 전체 도구 모음을 이용할 수 있는 구독 서비스로, 매월 갱신되는 할당량이 제공돼요. 또한 현재 주기의 할당량이 소진되었을 때 크레딧을 충전하여 더 많은 콘텐츠를 생성할 수도 있어요. 자세한 내용은 요금 페이지 https://deepai.org/pricing에서 확인할 수 있어요.
요금: API 호출은 DeepAI Pro 멤버십에 포함되어 있어요. 각 생성 작업은 월별 할당량에서 사용되거나 선불 지갑 잔액에서 차감돼요.
DeepAI는 다양한 이미지 API를 제공해요. 각 API는 어떤 프로그래밍 언어에서든 호출할 수 있는 간단한 HTTP 엔드포인트로, 예를 들면 다음과 같아요:모든 DeepAI API는 단일 POST 요청으로 이루어져요. 모델의 입력값을 multipart/form-data 형식으로 전송하고, 요청 헤더에 API 키를 포함하여 인증하세요.
로그인한 후 계정 대시보드에서 키를 복사하세요. API에 액세스하려면 DeepAI Pro 구독이 필요해요. 키는 비밀로 유지하세요. 비밀번호처럼 취급하고, 클라이언트 측 코드에 절대 노출하지 마세요.
api-key 헤더에 키를 전달하고, 모델의 입력값을 폼 필드로 전달하세요. 엔드포인트 URL은 https://api.deepai.org/api/<model>이고, 여기서 <model>은 모델 ID예요(아래 각 모델에 표시되어 있어요).
curl -X POST https://api.deepai.org/api/text2img \
-H 'api-key:YOUR_API_KEY' \
-F 'text=a serene mountain lake at sunrise'
성공 시 JSON 본문이 포함된 200 OK를 받게 돼요. output_url은 생성된 파일로 연결되는 링크이고, id는 고유한 작업 식별자예요:
{
"id": "59a0e8a9-...",
"output_url": "https://api.deepai.org/job-view-file/.../output.jpg"
}
오류가 발생하면 200이 아닌 상태 코드와 함께 err 또는 status 메시지가 포함된 JSON 본문이 반환돼요:
텍스트 프롬프트나 소스 이미지를 바탕으로 동영상을 생성해요. 동영상 생성은 몇 분 정도 소요되므로, 이미지 API와 달리 비동기 방식으로 진행돼요. 즉, 작업을 제출하고 작업 id를 수신한 후, 동영상이 준비될 때까지 상태 엔드포인트를 주기적으로 확인해야 해요.
요금: 동영상 생성에는 DeepAI Pro가 필요하며, 생성된 동영상의 초당 요금이 청구돼요. 요금은 먼저 월간 할당량(Standard 25초, Hollywood 모드 8초)에서 차감된 후, 선불 지갑에서 차감돼요(Standard 1초당 20¢, Hollywood 모드 1초당 30¢). 요금 섹션을 참조하세요.
텍스트를 동영상으로 변환: POST https://api.deepai.org/video-api/text2video
이미지를 동영상으로 변환: POST https://api.deepai.org/video-api/img2video
작업 상태: GET https://api.deepai.org/video-api/status/<id>
매개변수는 이미지 API와 똑같이 multipart/form-data, form-urlencoded 또는 application/json 본문(image는 URL 또는 base64 데이터로)으로 보내고, 키는 api-key 헤더에 넣어 주세요. 이 헤더는 상태 확인 요청을 포함한 모든 호출에 필요하며, 브라우저 세션으로는 이 경로들이 인증되지 않아요.
| 매개변수 | 유형 | 필수 | 기본값 |
|---|---|---|---|
prompt | string | text2video: 예 img2video: 아니요 | — |
image | 파일, URL 또는 base64 | img2video 전용: 예 | — |
mode | string | 아니요 | hd |
duration | integer | 아니요 | 5 |
shape | string | 아니요 | auto |
prompt — 생성할 내용, 최대 3,000자(이보다 긴 프롬프트는 400 오류와 함께 거부돼요). img2video에서는 선택 사항이에요(원본 이미지만으로도 충분해요).
image — img2video의 원본 이미지: 파일 필드로 업로드하거나, 공개 http(s) URL을 전달하거나, base64 데이터(원본 데이터 또는 data:image/...;base64, URL)를 보낼 수 있어요. 최대 20MB이며, 이미지로 디코딩되어야 해요. 리디렉션은 따라가요.
mode — 일반 동영상은 hd, 2K 영화급 화질의 동영상은 hollywood.
duration — 생성되는 동영상의 길이(초 단위), 5~15초. 요금은 초 단위로 청구돼요.
shape — square, landscape, standard, vertical, portrait 또는 auto. auto를 지정하면 img2video는 원본 이미지의 비율을 그대로 따르고, text2video는 가로(landscape)를 사용해요. hollywood 모드에서는 img2video가 항상 원본 이미지의 비율을 유지하므로, 이 경우 shape는 auto로 설정해야 해요.
curl -X POST https://api.deepai.org/video-api/text2video \
-H 'api-key:YOUR_API_KEY' \
-F 'prompt=a golden retriever surfing a wave at sunset' \
-F 'mode=hd' \
-F 'duration=5' \
-F 'shape=landscape'
파일이나 URL에서 이미지를 동영상으로 변환:
curl -X POST https://api.deepai.org/video-api/img2video \
-H 'api-key:YOUR_API_KEY' \
-F 'image=@/path/to/photo.jpg' \
-F 'prompt=the camera slowly zooms in'
제출에 성공하면 폴링할 작업 ID가 반환돼요:
{
"id": "59a0e8a9-...",
"status": "processing"
}
몇 초마다 상태 엔드포인트를 폴링하세요. status는 processing, completed 또는 failed 중 하나예요:
curl https://api.deepai.org/video-api/status/59a0e8a9-... \
-H 'api-key:YOUR_API_KEY'
{"status": "processing"}
{"status": "completed", "output_url": "https://...mp4"}
{"status": "failed", "error": "..."}
파이썬으로 작성된 완전한 예제:
import time, requests
headers = {'api-key': 'YOUR_API_KEY'}
job = requests.post(
'https://api.deepai.org/video-api/text2video',
data={'prompt': 'a golden retriever surfing a wave at sunset',
'mode': 'hd', 'duration': 5, 'shape': 'landscape'},
headers=headers).json()
while True:
status = requests.get(
'https://api.deepai.org/video-api/status/' + job['id'],
headers=headers).json()
if status['status'] == 'completed':
print(status['output_url'])
break
if status['status'] == 'failed':
raise RuntimeError(status['error'])
time.sleep(5)
output_url)는 완료 후 1시간 동안만 이용할 수 있고, 그 이후에는 상태 엔드포인트가 404를 반환해요. 동영상이 완료되면 바로 다운로드하세요.401은 api-key 헤더가 없거나 유효하지 않다는 뜻이에요. 403은 계정에 활성 DeepAI Pro 구독이 없다는 뜻이에요.402 응답이 오면 지갑 잔액으로 동영상 요금을 충당할 수 없거나(본문에 요금과 잔액이 포함돼요) 결제 실패로 계정이 잠긴 상태라는 뜻이에요. 대시보드에서 크레딧을 추가하거나 자동 충전을 활성화하세요.400 오류와 함께 거부되고, 생성 중 동영상 제공자가 문제로 표시한 콘텐츠는 {"status": "failed", "error": "NSFW detected"}로 표시돼요.이것은 AI 이미지 생성기예요. 텍스트 설명을 바탕으로 이미지를 처음부터 생성해요.
엔드포인트: POST https://api.deepai.org/api/text2img
| 매개변수 | 유형 | 필수 | 기본값 |
|---|---|---|---|
text |
text | 네 | — |
text — 생성할 내용을 설명하는 문자열. 예: “고요한 호수 위로 펼쳐진 별이 빛나는 밤” 또는 “늙은 해적의 초상화”.
width, height — 문자열(예: "256" 또는 "768")로 전달해요(기본값 512). 128에서 1536 사이의 값을 32의 배수로 지정하세요. Standard 이미지 권장 크기: 1024x576, 1024x720, 512x512, 768x1024, 576x1024. HD 이미지 권장 크기: 1216x832, 1152x896, 1024x1024, 896x1152, 832x1216. 약 700보다 크거나 256보다 작은 값은 이상한 결과가 나올 수 있어요.
image_generator_version — "standard"(기본값), "hd", "genius" 또는 "super_genius".
resolution — "2k"(기본값) 또는 "4k". image_generator_version 값이 "super_genius"인 경우에만 사용돼요.
genius_preference — "anime", "photography", "graphic" 또는 "cinematic". image_generator_version 값이 "genius"일 때만 사용돼요.
negative_prompt — 이미지에서 제거할 요소를 설명하는 문자열로, 품질과 디테일을 개선하는 데 유용해요. 예: bad anatomy, blurry, cropped, deformed, disfigured, duplicate, extra limbs, fused fingers, jpeg artifacts, low quality, lowres, mutated hands, out of frame, signature, text, watermark, worst quality.
AI 이미지 생성기 cURL 예시
# Example posting a text URL:
curl \
-F 'text=YOUR_TEXT_HERE' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/text2img
# Example posting a local text file:
curl \
-F 'text=YOUR_TEXT_HERE' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/text2img
# Example directly sending a text string:
curl \
-F 'text=YOUR_TEXT_HERE' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/text2img
AI 이미지 생성기 Javascript 예시
// Example posting a text URL:
(async function() {
const resp = await fetch('https://api.deepai.org/api/text2img', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
text: "YOUR_TEXT_HERE",
})
});
const data = await resp.json();
console.log(data);
})()
// Example posting file picker input text (Browser only):
document.getElementById('yourFileInputId').addEventListener('change', async function() {
const formData = new FormData();
formData.append('text', 'YOUR_TEXT_HERE');
const resp = await fetch('https://api.deepai.org/api/text2img', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
// Example posting a local text file (Node.js only):
const fs = require('fs');
(async function() {
const formData = new FormData();
formData.append('text', 'YOUR_TEXT_HERE');
const resp = await fetch('https://api.deepai.org/api/text2img', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
// Example directly sending a text string:
(async function() {
const resp = await fetch('https://api.deepai.org/api/text2img', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
text: "YOUR_TEXT_HERE",
})
});
const data = await resp.json();
console.log(data);
})()
AI 이미지 생성기 Python 예시
# Example posting a text URL:
import requests
r = requests.post(
"https://api.deepai.org/api/text2img",
data={
'text': 'YOUR_TEXT_HERE',
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
# Example posting a local text file:
import requests
r = requests.post(
"https://api.deepai.org/api/text2img",
data={
'text': 'YOUR_TEXT_HERE',
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
# Example directly sending a text string:
import requests
r = requests.post(
"https://api.deepai.org/api/text2img",
data={
'text': 'YOUR_TEXT_HERE',
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
AI 이미지 생성기 Ruby 예시
# Example posting a text URL:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/text2img', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'text' => 'YOUR_TEXT_HERE',
}
)
puts r
# Example posting a local text file:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/text2img', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'text' => 'YOUR_TEXT_HERE',
}
)
puts r
# Example directly sending a text string:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/text2img', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'text' => 'YOUR_TEXT_HERE',
}
)
puts r
AI 이미지 생성기 Php 예시
// Example posting a text URL:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'text',
'contents' => 'YOUR_TEXT_HERE'
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/text2img', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
// Example posting a local text file:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'text',
'contents' => 'YOUR_TEXT_HERE'
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/text2img', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
// Example directly sending a text string:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'text',
'contents' => 'YOUR_TEXT_HERE'
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/text2img', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
AI 이미지 생성기 Go 예시
// Example posting a text URL:
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.deepai.org/api/text2img"
payload := map[string]string{
"text": "YOUR_TEXT_HERE",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
// Example posting a local text file:
package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
url := "https://api.deepai.org/api/text2img"
var b bytes.Buffer
w := multipart.NewWriter(&b)
w.WriteField("text", "YOUR_TEXT_HERE")
if err := w.Close(); err != nil {
panic(err)
}
req, _ := http.NewRequest("POST", url, &b)
req.Header.Set("Content-Type", w.FormDataContentType())
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
// Example directly sending a text string:
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.deepai.org/api/text2img"
payload := map[string]string{
"text": "YOUR_TEXT_HERE",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
AI 이미지 생성기 Java 예시
// Example posting a text URL:
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String json = "{" +
"\"text\": \"YOUR_TEXT_HERE\"" +
"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/text2img"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
// Example posting a local text file:
// Add to build.gradle: implementation 'com.squareup.okhttp3:okhttp:4.12.0'
import okhttp3.*;
import java.io.File;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("text", "YOUR_TEXT_HERE")
.build();
Request request = new Request.Builder()
.url("https://api.deepai.org/api/text2img")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}
}
}
// Example directly sending a text string:
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String json = "{" +
"\"text\": \"YOUR_TEXT_HERE\"" +
"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/text2img"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
AI 이미지 생성기 C# 예시
// Example posting a text URL:
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
var payload = new
{
text = "YOUR_TEXT_HERE",
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.deepai.org/api/text2img", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
// Example posting a local text file:
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
using var form = new MultipartFormDataContent();
form.Add(new StringContent("YOUR_TEXT_HERE"), "text");
var response = await client.PostAsync("https://api.deepai.org/api/text2img", form);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
// Example directly sending a text string:
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
var payload = new
{
text = "YOUR_TEXT_HERE",
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.deepai.org/api/text2img", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
AI 이미지 생성기 Swift 예시
// Example posting a text URL:
import Foundation
let url = URL(string: "https://api.deepai.org/api/text2img")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let payload: [String: Any] = [
"text": "YOUR_TEXT_HERE",
]
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
// Keep the program running for async request
RunLoop.main.run()
// Example posting a local text file:
import Foundation
let url = URL(string: "https://api.deepai.org/api/text2img")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let boundary = UUID().uuidString
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
var body = Data()
body.append("--\(boundary)\r\n".data(using: .utf8)!)
body.append("Content-Disposition: form-data; name=\"text\"\r\n\r\n".data(using: .utf8)!)
body.append("YOUR_TEXT_HERE".data(using: .utf8)!)
body.append("\r\n".data(using: .utf8)!)
body.append("--\(boundary)--\r\n".data(using: .utf8)!)
request.httpBody = body
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
RunLoop.main.run()
// Example directly sending a text string:
import Foundation
let url = URL(string: "https://api.deepai.org/api/text2img")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let payload: [String: Any] = [
"text": "YOUR_TEXT_HERE",
]
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
RunLoop.main.run()
AI 이미지 생성기 Kotlin 예시
// Example posting a text URL:
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
fun main() {
val client = HttpClient.newHttpClient()
val json = """{
"text": "YOUR_TEXT_HERE"
}"""
val request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/text2img"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
// Example posting a local text file:
// Add to build.gradle.kts: implementation("com.squareup.okhttp3:okhttp:4.12.0")
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody.Companion.asRequestBody
import java.io.File
fun main() {
val client = OkHttpClient()
val requestBody = MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("text", "YOUR_TEXT_HERE")
.build()
val request = Request.Builder()
.url("https://api.deepai.org/api/text2img")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build()
client.newCall(request).execute().use { response ->
println(response.body?.string())
}
}
// Example directly sending a text string:
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
fun main() {
val client = HttpClient.newHttpClient()
val json = """{
"text": "YOUR_TEXT_HERE"
}"""
val request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/text2img"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
AI 이미지 생성기 Rust 예시
// Example posting a text URL:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use reqwest::header::HeaderMap;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let mut headers = HeaderMap::new();
headers.insert("api-key", "YOUR_API_KEY".parse()?);
let mut payload = HashMap::new();
payload.insert("text", "YOUR_TEXT_HERE");
let response = client
.post("https://api.deepai.org/api/text2img")
.headers(headers)
.json(&payload)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
// Example posting a local text file:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
use reqwest::multipart;
use std::fs;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let form = multipart::Form::new()
.text("text", "YOUR_TEXT_HERE");
let response = client
.post("https://api.deepai.org/api/text2img")
.header("api-key", "YOUR_API_KEY")
.multipart(form)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
// Example directly sending a text string:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use reqwest::header::HeaderMap;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let mut headers = HeaderMap::new();
headers.insert("api-key", "YOUR_API_KEY".parse()?);
let mut payload = HashMap::new();
payload.insert("text", "YOUR_TEXT_HERE");
let response = client
.post("https://api.deepai.org/api/text2img")
.headers(headers)
.json(&payload)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
AI 이미지 생성기 TypeScript 예시
// Example posting a text URL:
interface ApiResponse {
// Define your response type here
[key: string]: unknown;
}
async function callApi(): Promise<ApiResponse> {
const response = await fetch('https://api.deepai.org/api/text2img', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
text: 'YOUR_TEXT_HERE',
})
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
callApi();
// Example posting a local text file (Node.js with form-data package):
// npm install form-data
import * as fs from 'fs';
import FormData from 'form-data';
interface ApiResponse {
[key: string]: unknown;
}
async function uploadFile(): Promise<ApiResponse> {
const formData = new FormData();
formData.append('text', 'YOUR_TEXT_HERE');
const response = await fetch('https://api.deepai.org/api/text2img', {
method: 'POST',
headers: {
...formData.getHeaders(),
'api-key': 'YOUR_API_KEY'
},
body: formData as unknown as BodyInit
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
uploadFile();
// Example directly sending a text string:
interface ApiResponse {
[key: string]: unknown;
}
async function callApi(): Promise<ApiResponse> {
const response = await fetch('https://api.deepai.org/api/text2img', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
text: 'YOUR_TEXT_HERE',
})
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
callApi();
AI 이미지 생성기 Dart 예시
// Example posting a text URL:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:convert';
import 'package:http/http.dart' as http;
Future<void> main() async {
final response = await http.post(
Uri.parse('https://api.deepai.org/api/text2img'),
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY',
},
body: jsonEncode({
'text': 'YOUR_TEXT_HERE',
}),
);
print(response.body);
}
// Example posting a local text file:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
var request = http.MultipartRequest(
'POST',
Uri.parse('https://api.deepai.org/api/text2img'),
);
request.headers['api-key'] = 'YOUR_API_KEY';
request.fields['text'] = 'YOUR_TEXT_HERE';
var response = await request.send();
var responseBody = await response.stream.bytesToString();
print(responseBody);
}
// Example directly sending a text string:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:convert';
import 'package:http/http.dart' as http;
Future<void> main() async {
final response = await http.post(
Uri.parse('https://api.deepai.org/api/text2img'),
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY',
},
body: jsonEncode({
'text': 'YOUR_TEXT_HERE',
}),
);
print(response.body);
}
AI 이미지 생성기 PowerShell 예시
# Example posting a text URL:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/text2img `
-Method Post `
-Form @{
text='YOUR_TEXT_HERE'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
# Example posting a local text file:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/text2img `
-Method Post `
-Form @{
text='YOUR_TEXT_HERE'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
# Example directly sending a text string:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/text2img `
-Method Post `
-Form @{
text='YOUR_TEXT_HERE'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
AI를 사용하여 이미지 배경을 제거하세요.
엔드포인트: POST https://api.deepai.org/api/background-remover
| 매개변수 | 유형 | 필수 | 기본값 |
|---|---|---|---|
image |
image | 네 | — |
배경 제거기 cURL 예시
# Example posting a image URL:
curl \
-F 'image=YOUR_IMAGE_URL' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/background-remover
# Example posting a local image file:
curl \
-F 'image=@/path/to/your/file.jpg' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/background-remover
배경 제거기 Javascript 예시
// Example posting a image URL:
(async function() {
const resp = await fetch('https://api.deepai.org/api/background-remover', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
image: "YOUR_IMAGE_URL",
})
});
const data = await resp.json();
console.log(data);
})()
// Example posting file picker input image (Browser only):
document.getElementById('yourFileInputId').addEventListener('change', async function() {
const formData = new FormData();
formData.append('image', this.files[0]);
const resp = await fetch('https://api.deepai.org/api/background-remover', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
// Example posting a local image file (Node.js only):
const fs = require('fs');
(async function() {
const formData = new FormData();
const jpgFileStream = fs.createReadStream("/path/to/your/file.jpg");
formData.append('image', jpgFileStream);
const resp = await fetch('https://api.deepai.org/api/background-remover', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
배경 제거기 Python 예시
# Example posting a image URL:
import requests
r = requests.post(
"https://api.deepai.org/api/background-remover",
data={
'image': 'YOUR_IMAGE_URL',
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
# Example posting a local image file:
import requests
r = requests.post(
"https://api.deepai.org/api/background-remover",
files={
'image': open('/path/to/your/file.jpg', 'rb'),
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
배경 제거기 Ruby 예시
# Example posting a image URL:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/background-remover', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'image' => 'YOUR_IMAGE_URL',
}
)
puts r
# Example posting a local image file:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/background-remover', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'image' => File.new('/path/to/your/file.jpg'),
}
)
puts r
배경 제거기 Php 예시
// Example posting a image URL:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'image',
'contents' => 'YOUR_IMAGE_URL'
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/background-remover', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
// Example posting a local image file:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'image',
'contents' => Utils::tryFopen('/path/to/your/file.jpg', 'r')
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/background-remover', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
배경 제거기 Go 예시
// Example posting a image URL:
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.deepai.org/api/background-remover"
payload := map[string]string{
"image": "YOUR_IMAGE_URL",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
// Example posting a local image file:
package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
url := "https://api.deepai.org/api/background-remover"
var b bytes.Buffer
w := multipart.NewWriter(&b)
imageFile, _ := os.Open("/path/to/your/file.jpg")
defer imageFile.Close()
imageWriter, _ := w.CreateFormFile("image", "file.jpg")
io.Copy(imageWriter, imageFile)
if err := w.Close(); err != nil {
panic(err)
}
req, _ := http.NewRequest("POST", url, &b)
req.Header.Set("Content-Type", w.FormDataContentType())
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
배경 제거기 Java 예시
// Example posting a image URL:
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String json = "{" +
"\"image\": \"YOUR_IMAGE_URL\"" +
"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/background-remover"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
// Example posting a local image file:
// Add to build.gradle: implementation 'com.squareup.okhttp3:okhttp:4.12.0'
import okhttp3.*;
import java.io.File;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("image", "file.jpg", RequestBody.create(new File("/path/to/your/file.jpg"), MediaType.parse("application/octet-stream")))
.build();
Request request = new Request.Builder()
.url("https://api.deepai.org/api/background-remover")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}
}
}
배경 제거기 C# 예시
// Example posting a image URL:
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
var payload = new
{
image = "YOUR_IMAGE_URL",
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.deepai.org/api/background-remover", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
// Example posting a local image file:
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
using var form = new MultipartFormDataContent();
var imageStream = File.OpenRead("/path/to/your/file.jpg");
form.Add(new StreamContent(imageStream), "image", "file.jpg");
var response = await client.PostAsync("https://api.deepai.org/api/background-remover", form);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
배경 제거기 Swift 예시
// Example posting a image URL:
import Foundation
let url = URL(string: "https://api.deepai.org/api/background-remover")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let payload: [String: Any] = [
"image": "YOUR_IMAGE_URL",
]
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
// Keep the program running for async request
RunLoop.main.run()
// Example posting a local image file:
import Foundation
let url = URL(string: "https://api.deepai.org/api/background-remover")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let boundary = UUID().uuidString
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
var body = Data()
let imageData = try! Data(contentsOf: URL(fileURLWithPath: "/path/to/your/file.jpg"))
body.append("--\(boundary)\r\n".data(using: .utf8)!)
body.append("Content-Disposition: form-data; name=\"image\"; filename=\"file.jpg\"\r\n".data(using: .utf8)!)
body.append("Content-Type: application/octet-stream\r\n\r\n".data(using: .utf8)!)
body.append(imageData)
body.append("\r\n".data(using: .utf8)!)
body.append("--\(boundary)--\r\n".data(using: .utf8)!)
request.httpBody = body
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
RunLoop.main.run()
배경 제거기 Kotlin 예시
// Example posting a image URL:
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
fun main() {
val client = HttpClient.newHttpClient()
val json = """{
"image": "YOUR_IMAGE_URL"
}"""
val request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/background-remover"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
// Example posting a local image file:
// Add to build.gradle.kts: implementation("com.squareup.okhttp3:okhttp:4.12.0")
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody.Companion.asRequestBody
import java.io.File
fun main() {
val client = OkHttpClient()
val requestBody = MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("image", "file.jpg", File("/path/to/your/file.jpg").asRequestBody("application/octet-stream".toMediaType()))
.build()
val request = Request.Builder()
.url("https://api.deepai.org/api/background-remover")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build()
client.newCall(request).execute().use { response ->
println(response.body?.string())
}
}
배경 제거기 Rust 예시
// Example posting a image URL:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use reqwest::header::HeaderMap;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let mut headers = HeaderMap::new();
headers.insert("api-key", "YOUR_API_KEY".parse()?);
let mut payload = HashMap::new();
payload.insert("image", "YOUR_IMAGE_URL");
let response = client
.post("https://api.deepai.org/api/background-remover")
.headers(headers)
.json(&payload)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
// Example posting a local image file:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
use reqwest::multipart;
use std::fs;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let form = multipart::Form::new()
.file("image", "/path/to/your/file.jpg")?;
let response = client
.post("https://api.deepai.org/api/background-remover")
.header("api-key", "YOUR_API_KEY")
.multipart(form)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
배경 제거기 TypeScript 예시
// Example posting a image URL:
interface ApiResponse {
// Define your response type here
[key: string]: unknown;
}
async function callApi(): Promise<ApiResponse> {
const response = await fetch('https://api.deepai.org/api/background-remover', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
image: 'YOUR_IMAGE_URL',
})
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
callApi();
// Example posting a local image file (Node.js with form-data package):
// npm install form-data
import * as fs from 'fs';
import FormData from 'form-data';
interface ApiResponse {
[key: string]: unknown;
}
async function uploadFile(): Promise<ApiResponse> {
const formData = new FormData();
formData.append('image', fs.createReadStream('/path/to/your/file.jpg'));
const response = await fetch('https://api.deepai.org/api/background-remover', {
method: 'POST',
headers: {
...formData.getHeaders(),
'api-key': 'YOUR_API_KEY'
},
body: formData as unknown as BodyInit
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
uploadFile();
배경 제거기 Dart 예시
// Example posting a image URL:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:convert';
import 'package:http/http.dart' as http;
Future<void> main() async {
final response = await http.post(
Uri.parse('https://api.deepai.org/api/background-remover'),
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY',
},
body: jsonEncode({
'image': 'YOUR_IMAGE_URL',
}),
);
print(response.body);
}
// Example posting a local image file:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
var request = http.MultipartRequest(
'POST',
Uri.parse('https://api.deepai.org/api/background-remover'),
);
request.headers['api-key'] = 'YOUR_API_KEY';
request.files.add(
await http.MultipartFile.fromPath('image', '/path/to/your/file.jpg'),
);
var response = await request.send();
var responseBody = await response.stream.bytesToString();
print(responseBody);
}
배경 제거기 PowerShell 예시
# Example posting a image URL:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/background-remover `
-Method Post `
-Form @{
image='YOUR_IMAGE_URL'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
# Example posting a local image file:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/background-remover `
-Method Post `
-Form @{
image=Get-Item -Path '/path/to/your/file.jpg'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
AI를 활용해 사진과 이미지를 편집하세요.
엔드포인트: POST https://api.deepai.org/api/image-editor
| 매개변수 | 유형 | 필수 | 기본값 |
|---|---|---|---|
image |
image | 네 | — |
text |
text | 네 | — |
image_generator_version — 선택 사항이에요. 더 높은 품질의 세밀한 편집을 원하면 "genius" 또는 "super_genius"를 전달하세요. 기본값은 Standard 편집기예요.
resolution — "2k"(기본값) 또는 "4k". image_generator_version 값이 "super_genius"인 경우에만 사용돼요.
AI 사진 편집기 cURL 예시
# Example posting a image URL:
curl \
-F 'image=YOUR_IMAGE_URL' \
-F 'text=YOUR_TEXT_HERE' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/image-editor
# Example posting a local image file:
curl \
-F 'image=@/path/to/your/file.jpg' \
-F 'text=YOUR_TEXT_HERE' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/image-editor
AI 사진 편집기 Javascript 예시
// Example posting a image URL:
(async function() {
const resp = await fetch('https://api.deepai.org/api/image-editor', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
image: "YOUR_IMAGE_URL",
text: "YOUR_TEXT_HERE",
})
});
const data = await resp.json();
console.log(data);
})()
// Example posting file picker input image (Browser only):
document.getElementById('yourFileInputId').addEventListener('change', async function() {
const formData = new FormData();
formData.append('image', this.files[0]);
formData.append('text', 'YOUR_TEXT_HERE');
const resp = await fetch('https://api.deepai.org/api/image-editor', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
// Example posting a local image file (Node.js only):
const fs = require('fs');
(async function() {
const formData = new FormData();
const jpgFileStream = fs.createReadStream("/path/to/your/file.jpg");
formData.append('image', jpgFileStream);
formData.append('text', 'YOUR_TEXT_HERE');
const resp = await fetch('https://api.deepai.org/api/image-editor', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
AI 사진 편집기 Python 예시
# Example posting a image URL:
import requests
r = requests.post(
"https://api.deepai.org/api/image-editor",
data={
'image': 'YOUR_IMAGE_URL',
'text': 'YOUR_TEXT_HERE',
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
# Example posting a local image file:
import requests
r = requests.post(
"https://api.deepai.org/api/image-editor",
files={
'image': open('/path/to/your/file.jpg', 'rb'),
},
data={
'text': 'YOUR_TEXT_HERE',
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
AI 사진 편집기 Ruby 예시
# Example posting a image URL:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/image-editor', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'image' => 'YOUR_IMAGE_URL',
'text' => 'YOUR_TEXT_HERE',
}
)
puts r
# Example posting a local image file:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/image-editor', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'image' => File.new('/path/to/your/file.jpg'),
'text' => 'YOUR_TEXT_HERE',
}
)
puts r
AI 사진 편집기 Php 예시
// Example posting a image URL:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'image',
'contents' => 'YOUR_IMAGE_URL'
],
[
'name' => 'text',
'contents' => 'YOUR_TEXT_HERE'
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/image-editor', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
// Example posting a local image file:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'image',
'contents' => Utils::tryFopen('/path/to/your/file.jpg', 'r')
],
[
'name' => 'text',
'contents' => 'YOUR_TEXT_HERE'
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/image-editor', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
AI 사진 편집기 Go 예시
// Example posting a image URL:
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.deepai.org/api/image-editor"
payload := map[string]string{
"image": "YOUR_IMAGE_URL",
"text": "YOUR_TEXT_HERE",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
// Example posting a local image file:
package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
url := "https://api.deepai.org/api/image-editor"
var b bytes.Buffer
w := multipart.NewWriter(&b)
imageFile, _ := os.Open("/path/to/your/file.jpg")
defer imageFile.Close()
imageWriter, _ := w.CreateFormFile("image", "file.jpg")
io.Copy(imageWriter, imageFile)
w.WriteField("text", "YOUR_TEXT_HERE")
if err := w.Close(); err != nil {
panic(err)
}
req, _ := http.NewRequest("POST", url, &b)
req.Header.Set("Content-Type", w.FormDataContentType())
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
AI 사진 편집기 Java 예시
// Example posting a image URL:
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String json = "{" +
"\"image\": \"YOUR_IMAGE_URL\"" +
"\"text\": \"YOUR_TEXT_HERE\"" +
"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/image-editor"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
// Example posting a local image file:
// Add to build.gradle: implementation 'com.squareup.okhttp3:okhttp:4.12.0'
import okhttp3.*;
import java.io.File;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("image", "file.jpg", RequestBody.create(new File("/path/to/your/file.jpg"), MediaType.parse("application/octet-stream")))
.addFormDataPart("text", "YOUR_TEXT_HERE")
.build();
Request request = new Request.Builder()
.url("https://api.deepai.org/api/image-editor")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}
}
}
AI 사진 편집기 C# 예시
// Example posting a image URL:
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
var payload = new
{
image = "YOUR_IMAGE_URL",
text = "YOUR_TEXT_HERE",
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.deepai.org/api/image-editor", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
// Example posting a local image file:
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
using var form = new MultipartFormDataContent();
var imageStream = File.OpenRead("/path/to/your/file.jpg");
form.Add(new StreamContent(imageStream), "image", "file.jpg");
form.Add(new StringContent("YOUR_TEXT_HERE"), "text");
var response = await client.PostAsync("https://api.deepai.org/api/image-editor", form);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
AI 사진 편집기 Swift 예시
// Example posting a image URL:
import Foundation
let url = URL(string: "https://api.deepai.org/api/image-editor")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let payload: [String: Any] = [
"image": "YOUR_IMAGE_URL",
"text": "YOUR_TEXT_HERE",
]
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
// Keep the program running for async request
RunLoop.main.run()
// Example posting a local image file:
import Foundation
let url = URL(string: "https://api.deepai.org/api/image-editor")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let boundary = UUID().uuidString
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
var body = Data()
let imageData = try! Data(contentsOf: URL(fileURLWithPath: "/path/to/your/file.jpg"))
body.append("--\(boundary)\r\n".data(using: .utf8)!)
body.append("Content-Disposition: form-data; name=\"image\"; filename=\"file.jpg\"\r\n".data(using: .utf8)!)
body.append("Content-Type: application/octet-stream\r\n\r\n".data(using: .utf8)!)
body.append(imageData)
body.append("\r\n".data(using: .utf8)!)
body.append("--\(boundary)\r\n".data(using: .utf8)!)
body.append("Content-Disposition: form-data; name=\"text\"\r\n\r\n".data(using: .utf8)!)
body.append("YOUR_TEXT_HERE".data(using: .utf8)!)
body.append("\r\n".data(using: .utf8)!)
body.append("--\(boundary)--\r\n".data(using: .utf8)!)
request.httpBody = body
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
RunLoop.main.run()
AI 사진 편집기 Kotlin 예시
// Example posting a image URL:
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
fun main() {
val client = HttpClient.newHttpClient()
val json = """{
"image": "YOUR_IMAGE_URL",
"text": "YOUR_TEXT_HERE"
}"""
val request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/image-editor"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
// Example posting a local image file:
// Add to build.gradle.kts: implementation("com.squareup.okhttp3:okhttp:4.12.0")
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody.Companion.asRequestBody
import java.io.File
fun main() {
val client = OkHttpClient()
val requestBody = MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("image", "file.jpg", File("/path/to/your/file.jpg").asRequestBody("application/octet-stream".toMediaType()))
.addFormDataPart("text", "YOUR_TEXT_HERE")
.build()
val request = Request.Builder()
.url("https://api.deepai.org/api/image-editor")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build()
client.newCall(request).execute().use { response ->
println(response.body?.string())
}
}
AI 사진 편집기 Rust 예시
// Example posting a image URL:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use reqwest::header::HeaderMap;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let mut headers = HeaderMap::new();
headers.insert("api-key", "YOUR_API_KEY".parse()?);
let mut payload = HashMap::new();
payload.insert("image", "YOUR_IMAGE_URL");
payload.insert("text", "YOUR_TEXT_HERE");
let response = client
.post("https://api.deepai.org/api/image-editor")
.headers(headers)
.json(&payload)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
// Example posting a local image file:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
use reqwest::multipart;
use std::fs;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let form = multipart::Form::new()
.file("image", "/path/to/your/file.jpg")?
.text("text", "YOUR_TEXT_HERE");
let response = client
.post("https://api.deepai.org/api/image-editor")
.header("api-key", "YOUR_API_KEY")
.multipart(form)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
AI 사진 편집기 TypeScript 예시
// Example posting a image URL:
interface ApiResponse {
// Define your response type here
[key: string]: unknown;
}
async function callApi(): Promise<ApiResponse> {
const response = await fetch('https://api.deepai.org/api/image-editor', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
image: 'YOUR_IMAGE_URL',
text: 'YOUR_TEXT_HERE',
})
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
callApi();
// Example posting a local image file (Node.js with form-data package):
// npm install form-data
import * as fs from 'fs';
import FormData from 'form-data';
interface ApiResponse {
[key: string]: unknown;
}
async function uploadFile(): Promise<ApiResponse> {
const formData = new FormData();
formData.append('image', fs.createReadStream('/path/to/your/file.jpg'));
formData.append('text', 'YOUR_TEXT_HERE');
const response = await fetch('https://api.deepai.org/api/image-editor', {
method: 'POST',
headers: {
...formData.getHeaders(),
'api-key': 'YOUR_API_KEY'
},
body: formData as unknown as BodyInit
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
uploadFile();
AI 사진 편집기 Dart 예시
// Example posting a image URL:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:convert';
import 'package:http/http.dart' as http;
Future<void> main() async {
final response = await http.post(
Uri.parse('https://api.deepai.org/api/image-editor'),
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY',
},
body: jsonEncode({
'image': 'YOUR_IMAGE_URL',
'text': 'YOUR_TEXT_HERE',
}),
);
print(response.body);
}
// Example posting a local image file:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
var request = http.MultipartRequest(
'POST',
Uri.parse('https://api.deepai.org/api/image-editor'),
);
request.headers['api-key'] = 'YOUR_API_KEY';
request.files.add(
await http.MultipartFile.fromPath('image', '/path/to/your/file.jpg'),
);
request.fields['text'] = 'YOUR_TEXT_HERE';
var response = await request.send();
var responseBody = await response.stream.bytesToString();
print(responseBody);
}
AI 사진 편집기 PowerShell 예시
# Example posting a image URL:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/image-editor `
-Method Post `
-Form @{
image='YOUR_IMAGE_URL'
text='YOUR_TEXT_HERE'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
# Example posting a local image file:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/image-editor `
-Method Post `
-Form @{
image=Get-Item -Path '/path/to/your/file.jpg'
text='YOUR_TEXT_HERE'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
오래된 가족 사진이나 역사적 사진에 색을 입히거나, 색상 복원 기술을 통해 오래된 필름에 새로운 생명을 불어넣어 보세요.
엔드포인트: POST https://api.deepai.org/api/colorizer
| 매개변수 | 유형 | 필수 | 기본값 |
|---|---|---|---|
image |
image | 네 | — |
이미지 색상 입히기 cURL 예시
# Example posting a image URL:
curl \
-F 'image=YOUR_IMAGE_URL' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/colorizer
# Example posting a local image file:
curl \
-F 'image=@/path/to/your/file.jpg' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/colorizer
이미지 색상 입히기 Javascript 예시
// Example posting a image URL:
(async function() {
const resp = await fetch('https://api.deepai.org/api/colorizer', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
image: "YOUR_IMAGE_URL",
})
});
const data = await resp.json();
console.log(data);
})()
// Example posting file picker input image (Browser only):
document.getElementById('yourFileInputId').addEventListener('change', async function() {
const formData = new FormData();
formData.append('image', this.files[0]);
const resp = await fetch('https://api.deepai.org/api/colorizer', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
// Example posting a local image file (Node.js only):
const fs = require('fs');
(async function() {
const formData = new FormData();
const jpgFileStream = fs.createReadStream("/path/to/your/file.jpg");
formData.append('image', jpgFileStream);
const resp = await fetch('https://api.deepai.org/api/colorizer', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
이미지 색상 입히기 Python 예시
# Example posting a image URL:
import requests
r = requests.post(
"https://api.deepai.org/api/colorizer",
data={
'image': 'YOUR_IMAGE_URL',
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
# Example posting a local image file:
import requests
r = requests.post(
"https://api.deepai.org/api/colorizer",
files={
'image': open('/path/to/your/file.jpg', 'rb'),
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
이미지 색상 입히기 Ruby 예시
# Example posting a image URL:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/colorizer', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'image' => 'YOUR_IMAGE_URL',
}
)
puts r
# Example posting a local image file:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/colorizer', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'image' => File.new('/path/to/your/file.jpg'),
}
)
puts r
이미지 색상 입히기 Php 예시
// Example posting a image URL:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'image',
'contents' => 'YOUR_IMAGE_URL'
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/colorizer', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
// Example posting a local image file:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'image',
'contents' => Utils::tryFopen('/path/to/your/file.jpg', 'r')
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/colorizer', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
이미지 색상 입히기 Go 예시
// Example posting a image URL:
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.deepai.org/api/colorizer"
payload := map[string]string{
"image": "YOUR_IMAGE_URL",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
// Example posting a local image file:
package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
url := "https://api.deepai.org/api/colorizer"
var b bytes.Buffer
w := multipart.NewWriter(&b)
imageFile, _ := os.Open("/path/to/your/file.jpg")
defer imageFile.Close()
imageWriter, _ := w.CreateFormFile("image", "file.jpg")
io.Copy(imageWriter, imageFile)
if err := w.Close(); err != nil {
panic(err)
}
req, _ := http.NewRequest("POST", url, &b)
req.Header.Set("Content-Type", w.FormDataContentType())
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
이미지 색상 입히기 Java 예시
// Example posting a image URL:
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String json = "{" +
"\"image\": \"YOUR_IMAGE_URL\"" +
"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/colorizer"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
// Example posting a local image file:
// Add to build.gradle: implementation 'com.squareup.okhttp3:okhttp:4.12.0'
import okhttp3.*;
import java.io.File;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("image", "file.jpg", RequestBody.create(new File("/path/to/your/file.jpg"), MediaType.parse("application/octet-stream")))
.build();
Request request = new Request.Builder()
.url("https://api.deepai.org/api/colorizer")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}
}
}
이미지 색상 입히기 C# 예시
// Example posting a image URL:
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
var payload = new
{
image = "YOUR_IMAGE_URL",
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.deepai.org/api/colorizer", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
// Example posting a local image file:
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
using var form = new MultipartFormDataContent();
var imageStream = File.OpenRead("/path/to/your/file.jpg");
form.Add(new StreamContent(imageStream), "image", "file.jpg");
var response = await client.PostAsync("https://api.deepai.org/api/colorizer", form);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
이미지 색상 입히기 Swift 예시
// Example posting a image URL:
import Foundation
let url = URL(string: "https://api.deepai.org/api/colorizer")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let payload: [String: Any] = [
"image": "YOUR_IMAGE_URL",
]
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
// Keep the program running for async request
RunLoop.main.run()
// Example posting a local image file:
import Foundation
let url = URL(string: "https://api.deepai.org/api/colorizer")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let boundary = UUID().uuidString
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
var body = Data()
let imageData = try! Data(contentsOf: URL(fileURLWithPath: "/path/to/your/file.jpg"))
body.append("--\(boundary)\r\n".data(using: .utf8)!)
body.append("Content-Disposition: form-data; name=\"image\"; filename=\"file.jpg\"\r\n".data(using: .utf8)!)
body.append("Content-Type: application/octet-stream\r\n\r\n".data(using: .utf8)!)
body.append(imageData)
body.append("\r\n".data(using: .utf8)!)
body.append("--\(boundary)--\r\n".data(using: .utf8)!)
request.httpBody = body
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
RunLoop.main.run()
이미지 색상 입히기 Kotlin 예시
// Example posting a image URL:
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
fun main() {
val client = HttpClient.newHttpClient()
val json = """{
"image": "YOUR_IMAGE_URL"
}"""
val request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/colorizer"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
// Example posting a local image file:
// Add to build.gradle.kts: implementation("com.squareup.okhttp3:okhttp:4.12.0")
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody.Companion.asRequestBody
import java.io.File
fun main() {
val client = OkHttpClient()
val requestBody = MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("image", "file.jpg", File("/path/to/your/file.jpg").asRequestBody("application/octet-stream".toMediaType()))
.build()
val request = Request.Builder()
.url("https://api.deepai.org/api/colorizer")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build()
client.newCall(request).execute().use { response ->
println(response.body?.string())
}
}
이미지 색상 입히기 Rust 예시
// Example posting a image URL:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use reqwest::header::HeaderMap;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let mut headers = HeaderMap::new();
headers.insert("api-key", "YOUR_API_KEY".parse()?);
let mut payload = HashMap::new();
payload.insert("image", "YOUR_IMAGE_URL");
let response = client
.post("https://api.deepai.org/api/colorizer")
.headers(headers)
.json(&payload)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
// Example posting a local image file:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
use reqwest::multipart;
use std::fs;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let form = multipart::Form::new()
.file("image", "/path/to/your/file.jpg")?;
let response = client
.post("https://api.deepai.org/api/colorizer")
.header("api-key", "YOUR_API_KEY")
.multipart(form)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
이미지 색상 입히기 TypeScript 예시
// Example posting a image URL:
interface ApiResponse {
// Define your response type here
[key: string]: unknown;
}
async function callApi(): Promise<ApiResponse> {
const response = await fetch('https://api.deepai.org/api/colorizer', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
image: 'YOUR_IMAGE_URL',
})
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
callApi();
// Example posting a local image file (Node.js with form-data package):
// npm install form-data
import * as fs from 'fs';
import FormData from 'form-data';
interface ApiResponse {
[key: string]: unknown;
}
async function uploadFile(): Promise<ApiResponse> {
const formData = new FormData();
formData.append('image', fs.createReadStream('/path/to/your/file.jpg'));
const response = await fetch('https://api.deepai.org/api/colorizer', {
method: 'POST',
headers: {
...formData.getHeaders(),
'api-key': 'YOUR_API_KEY'
},
body: formData as unknown as BodyInit
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
uploadFile();
이미지 색상 입히기 Dart 예시
// Example posting a image URL:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:convert';
import 'package:http/http.dart' as http;
Future<void> main() async {
final response = await http.post(
Uri.parse('https://api.deepai.org/api/colorizer'),
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY',
},
body: jsonEncode({
'image': 'YOUR_IMAGE_URL',
}),
);
print(response.body);
}
// Example posting a local image file:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
var request = http.MultipartRequest(
'POST',
Uri.parse('https://api.deepai.org/api/colorizer'),
);
request.headers['api-key'] = 'YOUR_API_KEY';
request.files.add(
await http.MultipartFile.fromPath('image', '/path/to/your/file.jpg'),
);
var response = await request.send();
var responseBody = await response.stream.bytesToString();
print(responseBody);
}
이미지 색상 입히기 PowerShell 예시
# Example posting a image URL:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/colorizer `
-Method Post `
-Form @{
image='YOUR_IMAGE_URL'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
# Example posting a local image file:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/colorizer `
-Method Post `
-Form @{
image=Get-Item -Path '/path/to/your/file.jpg'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
초고해상도 API는 머신 러닝을 활용해 사진의 내용과 고유한 특징을 잃지 않으면서 이미지를 선명하게 하고, 디테일을 살리며, 해상도를 높여 줘요. 안타깝게도 흐릿한 이미지는 흔히 볼 수 있으며, 전문가와 취미 사진가 모두에게 골칫거리예요. 초고해상도 기술은 머신 러닝 기법으로 눈 깜짝할 사이에 이미지의 해상도를 높여 줘요.
엔드포인트: POST https://api.deepai.org/api/torch-srgan
| 매개변수 | 유형 | 필수 | 기본값 |
|---|---|---|---|
image |
image | 네 | — |
초고해상도 cURL 예시
# Example posting a image URL:
curl \
-F 'image=YOUR_IMAGE_URL' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/torch-srgan
# Example posting a local image file:
curl \
-F 'image=@/path/to/your/file.jpg' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/torch-srgan
초고해상도 Javascript 예시
// Example posting a image URL:
(async function() {
const resp = await fetch('https://api.deepai.org/api/torch-srgan', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
image: "YOUR_IMAGE_URL",
})
});
const data = await resp.json();
console.log(data);
})()
// Example posting file picker input image (Browser only):
document.getElementById('yourFileInputId').addEventListener('change', async function() {
const formData = new FormData();
formData.append('image', this.files[0]);
const resp = await fetch('https://api.deepai.org/api/torch-srgan', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
// Example posting a local image file (Node.js only):
const fs = require('fs');
(async function() {
const formData = new FormData();
const jpgFileStream = fs.createReadStream("/path/to/your/file.jpg");
formData.append('image', jpgFileStream);
const resp = await fetch('https://api.deepai.org/api/torch-srgan', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
초고해상도 Python 예시
# Example posting a image URL:
import requests
r = requests.post(
"https://api.deepai.org/api/torch-srgan",
data={
'image': 'YOUR_IMAGE_URL',
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
# Example posting a local image file:
import requests
r = requests.post(
"https://api.deepai.org/api/torch-srgan",
files={
'image': open('/path/to/your/file.jpg', 'rb'),
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
초고해상도 Ruby 예시
# Example posting a image URL:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/torch-srgan', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'image' => 'YOUR_IMAGE_URL',
}
)
puts r
# Example posting a local image file:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/torch-srgan', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'image' => File.new('/path/to/your/file.jpg'),
}
)
puts r
초고해상도 Php 예시
// Example posting a image URL:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'image',
'contents' => 'YOUR_IMAGE_URL'
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/torch-srgan', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
// Example posting a local image file:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'image',
'contents' => Utils::tryFopen('/path/to/your/file.jpg', 'r')
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/torch-srgan', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
초고해상도 Go 예시
// Example posting a image URL:
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.deepai.org/api/torch-srgan"
payload := map[string]string{
"image": "YOUR_IMAGE_URL",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
// Example posting a local image file:
package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
url := "https://api.deepai.org/api/torch-srgan"
var b bytes.Buffer
w := multipart.NewWriter(&b)
imageFile, _ := os.Open("/path/to/your/file.jpg")
defer imageFile.Close()
imageWriter, _ := w.CreateFormFile("image", "file.jpg")
io.Copy(imageWriter, imageFile)
if err := w.Close(); err != nil {
panic(err)
}
req, _ := http.NewRequest("POST", url, &b)
req.Header.Set("Content-Type", w.FormDataContentType())
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
초고해상도 Java 예시
// Example posting a image URL:
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String json = "{" +
"\"image\": \"YOUR_IMAGE_URL\"" +
"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/torch-srgan"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
// Example posting a local image file:
// Add to build.gradle: implementation 'com.squareup.okhttp3:okhttp:4.12.0'
import okhttp3.*;
import java.io.File;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("image", "file.jpg", RequestBody.create(new File("/path/to/your/file.jpg"), MediaType.parse("application/octet-stream")))
.build();
Request request = new Request.Builder()
.url("https://api.deepai.org/api/torch-srgan")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}
}
}
초고해상도 C# 예시
// Example posting a image URL:
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
var payload = new
{
image = "YOUR_IMAGE_URL",
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.deepai.org/api/torch-srgan", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
// Example posting a local image file:
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
using var form = new MultipartFormDataContent();
var imageStream = File.OpenRead("/path/to/your/file.jpg");
form.Add(new StreamContent(imageStream), "image", "file.jpg");
var response = await client.PostAsync("https://api.deepai.org/api/torch-srgan", form);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
초고해상도 Swift 예시
// Example posting a image URL:
import Foundation
let url = URL(string: "https://api.deepai.org/api/torch-srgan")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let payload: [String: Any] = [
"image": "YOUR_IMAGE_URL",
]
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
// Keep the program running for async request
RunLoop.main.run()
// Example posting a local image file:
import Foundation
let url = URL(string: "https://api.deepai.org/api/torch-srgan")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let boundary = UUID().uuidString
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
var body = Data()
let imageData = try! Data(contentsOf: URL(fileURLWithPath: "/path/to/your/file.jpg"))
body.append("--\(boundary)\r\n".data(using: .utf8)!)
body.append("Content-Disposition: form-data; name=\"image\"; filename=\"file.jpg\"\r\n".data(using: .utf8)!)
body.append("Content-Type: application/octet-stream\r\n\r\n".data(using: .utf8)!)
body.append(imageData)
body.append("\r\n".data(using: .utf8)!)
body.append("--\(boundary)--\r\n".data(using: .utf8)!)
request.httpBody = body
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
RunLoop.main.run()
초고해상도 Kotlin 예시
// Example posting a image URL:
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
fun main() {
val client = HttpClient.newHttpClient()
val json = """{
"image": "YOUR_IMAGE_URL"
}"""
val request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/torch-srgan"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
// Example posting a local image file:
// Add to build.gradle.kts: implementation("com.squareup.okhttp3:okhttp:4.12.0")
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody.Companion.asRequestBody
import java.io.File
fun main() {
val client = OkHttpClient()
val requestBody = MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("image", "file.jpg", File("/path/to/your/file.jpg").asRequestBody("application/octet-stream".toMediaType()))
.build()
val request = Request.Builder()
.url("https://api.deepai.org/api/torch-srgan")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build()
client.newCall(request).execute().use { response ->
println(response.body?.string())
}
}
초고해상도 Rust 예시
// Example posting a image URL:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use reqwest::header::HeaderMap;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let mut headers = HeaderMap::new();
headers.insert("api-key", "YOUR_API_KEY".parse()?);
let mut payload = HashMap::new();
payload.insert("image", "YOUR_IMAGE_URL");
let response = client
.post("https://api.deepai.org/api/torch-srgan")
.headers(headers)
.json(&payload)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
// Example posting a local image file:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
use reqwest::multipart;
use std::fs;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let form = multipart::Form::new()
.file("image", "/path/to/your/file.jpg")?;
let response = client
.post("https://api.deepai.org/api/torch-srgan")
.header("api-key", "YOUR_API_KEY")
.multipart(form)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
초고해상도 TypeScript 예시
// Example posting a image URL:
interface ApiResponse {
// Define your response type here
[key: string]: unknown;
}
async function callApi(): Promise<ApiResponse> {
const response = await fetch('https://api.deepai.org/api/torch-srgan', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
image: 'YOUR_IMAGE_URL',
})
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
callApi();
// Example posting a local image file (Node.js with form-data package):
// npm install form-data
import * as fs from 'fs';
import FormData from 'form-data';
interface ApiResponse {
[key: string]: unknown;
}
async function uploadFile(): Promise<ApiResponse> {
const formData = new FormData();
formData.append('image', fs.createReadStream('/path/to/your/file.jpg'));
const response = await fetch('https://api.deepai.org/api/torch-srgan', {
method: 'POST',
headers: {
...formData.getHeaders(),
'api-key': 'YOUR_API_KEY'
},
body: formData as unknown as BodyInit
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
uploadFile();
초고해상도 Dart 예시
// Example posting a image URL:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:convert';
import 'package:http/http.dart' as http;
Future<void> main() async {
final response = await http.post(
Uri.parse('https://api.deepai.org/api/torch-srgan'),
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY',
},
body: jsonEncode({
'image': 'YOUR_IMAGE_URL',
}),
);
print(response.body);
}
// Example posting a local image file:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
var request = http.MultipartRequest(
'POST',
Uri.parse('https://api.deepai.org/api/torch-srgan'),
);
request.headers['api-key'] = 'YOUR_API_KEY';
request.files.add(
await http.MultipartFile.fromPath('image', '/path/to/your/file.jpg'),
);
var response = await request.send();
var responseBody = await response.stream.bytesToString();
print(responseBody);
}
초고해상도 PowerShell 예시
# Example posting a image URL:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/torch-srgan `
-Method Post `
-Form @{
image='YOUR_IMAGE_URL'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
# Example posting a local image file:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/torch-srgan `
-Method Post `
-Form @{
image=Get-Item -Path '/path/to/your/file.jpg'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
Waifu2x는 이미지의 노이즈를 줄이면서 해상도를 높이는 알고리즘이에요. 이름은 주로 학습에 사용된 ‘와이푸’라고 불리는 애니메이션 스타일 그림에서 유래했어요. 학습 데이터의 대부분이 와이푸 이미지였지만, 이 Waifu2x API는 사진이나 다른 유형의 이미지에서도 우수한 성능을 발휘해요. Waifu2x로 노이즈를 줄이면서 이미지 크기를 두 배로 키울 수 있어요.
엔드포인트: POST https://api.deepai.org/api/waifu2x
| 매개변수 | 유형 | 필수 | 기본값 |
|---|---|---|---|
image |
image | 네 | — |
Waifu2x cURL 예시
# Example posting a image URL:
curl \
-F 'image=YOUR_IMAGE_URL' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/waifu2x
# Example posting a local image file:
curl \
-F 'image=@/path/to/your/file.jpg' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/waifu2x
Waifu2x Javascript 예시
// Example posting a image URL:
(async function() {
const resp = await fetch('https://api.deepai.org/api/waifu2x', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
image: "YOUR_IMAGE_URL",
})
});
const data = await resp.json();
console.log(data);
})()
// Example posting file picker input image (Browser only):
document.getElementById('yourFileInputId').addEventListener('change', async function() {
const formData = new FormData();
formData.append('image', this.files[0]);
const resp = await fetch('https://api.deepai.org/api/waifu2x', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
// Example posting a local image file (Node.js only):
const fs = require('fs');
(async function() {
const formData = new FormData();
const jpgFileStream = fs.createReadStream("/path/to/your/file.jpg");
formData.append('image', jpgFileStream);
const resp = await fetch('https://api.deepai.org/api/waifu2x', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
Waifu2x Python 예시
# Example posting a image URL:
import requests
r = requests.post(
"https://api.deepai.org/api/waifu2x",
data={
'image': 'YOUR_IMAGE_URL',
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
# Example posting a local image file:
import requests
r = requests.post(
"https://api.deepai.org/api/waifu2x",
files={
'image': open('/path/to/your/file.jpg', 'rb'),
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
Waifu2x Ruby 예시
# Example posting a image URL:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/waifu2x', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'image' => 'YOUR_IMAGE_URL',
}
)
puts r
# Example posting a local image file:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/waifu2x', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'image' => File.new('/path/to/your/file.jpg'),
}
)
puts r
Waifu2x Php 예시
// Example posting a image URL:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'image',
'contents' => 'YOUR_IMAGE_URL'
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/waifu2x', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
// Example posting a local image file:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'image',
'contents' => Utils::tryFopen('/path/to/your/file.jpg', 'r')
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/waifu2x', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
Waifu2x Go 예시
// Example posting a image URL:
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.deepai.org/api/waifu2x"
payload := map[string]string{
"image": "YOUR_IMAGE_URL",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
// Example posting a local image file:
package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
url := "https://api.deepai.org/api/waifu2x"
var b bytes.Buffer
w := multipart.NewWriter(&b)
imageFile, _ := os.Open("/path/to/your/file.jpg")
defer imageFile.Close()
imageWriter, _ := w.CreateFormFile("image", "file.jpg")
io.Copy(imageWriter, imageFile)
if err := w.Close(); err != nil {
panic(err)
}
req, _ := http.NewRequest("POST", url, &b)
req.Header.Set("Content-Type", w.FormDataContentType())
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
Waifu2x Java 예시
// Example posting a image URL:
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String json = "{" +
"\"image\": \"YOUR_IMAGE_URL\"" +
"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/waifu2x"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
// Example posting a local image file:
// Add to build.gradle: implementation 'com.squareup.okhttp3:okhttp:4.12.0'
import okhttp3.*;
import java.io.File;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("image", "file.jpg", RequestBody.create(new File("/path/to/your/file.jpg"), MediaType.parse("application/octet-stream")))
.build();
Request request = new Request.Builder()
.url("https://api.deepai.org/api/waifu2x")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}
}
}
Waifu2x C# 예시
// Example posting a image URL:
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
var payload = new
{
image = "YOUR_IMAGE_URL",
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.deepai.org/api/waifu2x", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
// Example posting a local image file:
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
using var form = new MultipartFormDataContent();
var imageStream = File.OpenRead("/path/to/your/file.jpg");
form.Add(new StreamContent(imageStream), "image", "file.jpg");
var response = await client.PostAsync("https://api.deepai.org/api/waifu2x", form);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
Waifu2x Swift 예시
// Example posting a image URL:
import Foundation
let url = URL(string: "https://api.deepai.org/api/waifu2x")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let payload: [String: Any] = [
"image": "YOUR_IMAGE_URL",
]
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
// Keep the program running for async request
RunLoop.main.run()
// Example posting a local image file:
import Foundation
let url = URL(string: "https://api.deepai.org/api/waifu2x")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let boundary = UUID().uuidString
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
var body = Data()
let imageData = try! Data(contentsOf: URL(fileURLWithPath: "/path/to/your/file.jpg"))
body.append("--\(boundary)\r\n".data(using: .utf8)!)
body.append("Content-Disposition: form-data; name=\"image\"; filename=\"file.jpg\"\r\n".data(using: .utf8)!)
body.append("Content-Type: application/octet-stream\r\n\r\n".data(using: .utf8)!)
body.append(imageData)
body.append("\r\n".data(using: .utf8)!)
body.append("--\(boundary)--\r\n".data(using: .utf8)!)
request.httpBody = body
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
RunLoop.main.run()
Waifu2x Kotlin 예시
// Example posting a image URL:
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
fun main() {
val client = HttpClient.newHttpClient()
val json = """{
"image": "YOUR_IMAGE_URL"
}"""
val request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/waifu2x"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
// Example posting a local image file:
// Add to build.gradle.kts: implementation("com.squareup.okhttp3:okhttp:4.12.0")
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody.Companion.asRequestBody
import java.io.File
fun main() {
val client = OkHttpClient()
val requestBody = MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("image", "file.jpg", File("/path/to/your/file.jpg").asRequestBody("application/octet-stream".toMediaType()))
.build()
val request = Request.Builder()
.url("https://api.deepai.org/api/waifu2x")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build()
client.newCall(request).execute().use { response ->
println(response.body?.string())
}
}
Waifu2x Rust 예시
// Example posting a image URL:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use reqwest::header::HeaderMap;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let mut headers = HeaderMap::new();
headers.insert("api-key", "YOUR_API_KEY".parse()?);
let mut payload = HashMap::new();
payload.insert("image", "YOUR_IMAGE_URL");
let response = client
.post("https://api.deepai.org/api/waifu2x")
.headers(headers)
.json(&payload)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
// Example posting a local image file:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
use reqwest::multipart;
use std::fs;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let form = multipart::Form::new()
.file("image", "/path/to/your/file.jpg")?;
let response = client
.post("https://api.deepai.org/api/waifu2x")
.header("api-key", "YOUR_API_KEY")
.multipart(form)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
Waifu2x TypeScript 예시
// Example posting a image URL:
interface ApiResponse {
// Define your response type here
[key: string]: unknown;
}
async function callApi(): Promise<ApiResponse> {
const response = await fetch('https://api.deepai.org/api/waifu2x', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
image: 'YOUR_IMAGE_URL',
})
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
callApi();
// Example posting a local image file (Node.js with form-data package):
// npm install form-data
import * as fs from 'fs';
import FormData from 'form-data';
interface ApiResponse {
[key: string]: unknown;
}
async function uploadFile(): Promise<ApiResponse> {
const formData = new FormData();
formData.append('image', fs.createReadStream('/path/to/your/file.jpg'));
const response = await fetch('https://api.deepai.org/api/waifu2x', {
method: 'POST',
headers: {
...formData.getHeaders(),
'api-key': 'YOUR_API_KEY'
},
body: formData as unknown as BodyInit
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
uploadFile();
Waifu2x Dart 예시
// Example posting a image URL:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:convert';
import 'package:http/http.dart' as http;
Future<void> main() async {
final response = await http.post(
Uri.parse('https://api.deepai.org/api/waifu2x'),
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY',
},
body: jsonEncode({
'image': 'YOUR_IMAGE_URL',
}),
);
print(response.body);
}
// Example posting a local image file:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
var request = http.MultipartRequest(
'POST',
Uri.parse('https://api.deepai.org/api/waifu2x'),
);
request.headers['api-key'] = 'YOUR_API_KEY';
request.files.add(
await http.MultipartFile.fromPath('image', '/path/to/your/file.jpg'),
);
var response = await request.send();
var responseBody = await response.stream.bytesToString();
print(responseBody);
}
Waifu2x PowerShell 예시
# Example posting a image URL:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/waifu2x `
-Method Post `
-Form @{
image='YOUR_IMAGE_URL'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
# Example posting a local image file:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/waifu2x `
-Method Post `
-Form @{
image=Get-Item -Path '/path/to/your/file.jpg'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
엔드포인트: POST https://api.deepai.org/api/creative-upscale
| 매개변수 | 유형 | 필수 | 기본값 |
|---|---|---|---|
image |
image | 네 | — |
크리에이티브 업스케일 cURL 예시
# Example posting a image URL:
curl \
-F 'image=YOUR_IMAGE_URL' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/creative-upscale
# Example posting a local image file:
curl \
-F 'image=@/path/to/your/file.jpg' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/creative-upscale
크리에이티브 업스케일 Javascript 예시
// Example posting a image URL:
(async function() {
const resp = await fetch('https://api.deepai.org/api/creative-upscale', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
image: "YOUR_IMAGE_URL",
})
});
const data = await resp.json();
console.log(data);
})()
// Example posting file picker input image (Browser only):
document.getElementById('yourFileInputId').addEventListener('change', async function() {
const formData = new FormData();
formData.append('image', this.files[0]);
const resp = await fetch('https://api.deepai.org/api/creative-upscale', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
// Example posting a local image file (Node.js only):
const fs = require('fs');
(async function() {
const formData = new FormData();
const jpgFileStream = fs.createReadStream("/path/to/your/file.jpg");
formData.append('image', jpgFileStream);
const resp = await fetch('https://api.deepai.org/api/creative-upscale', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
크리에이티브 업스케일 Python 예시
# Example posting a image URL:
import requests
r = requests.post(
"https://api.deepai.org/api/creative-upscale",
data={
'image': 'YOUR_IMAGE_URL',
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
# Example posting a local image file:
import requests
r = requests.post(
"https://api.deepai.org/api/creative-upscale",
files={
'image': open('/path/to/your/file.jpg', 'rb'),
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
크리에이티브 업스케일 Ruby 예시
# Example posting a image URL:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/creative-upscale', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'image' => 'YOUR_IMAGE_URL',
}
)
puts r
# Example posting a local image file:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/creative-upscale', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'image' => File.new('/path/to/your/file.jpg'),
}
)
puts r
크리에이티브 업스케일 Php 예시
// Example posting a image URL:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'image',
'contents' => 'YOUR_IMAGE_URL'
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/creative-upscale', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
// Example posting a local image file:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'image',
'contents' => Utils::tryFopen('/path/to/your/file.jpg', 'r')
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/creative-upscale', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
크리에이티브 업스케일 Go 예시
// Example posting a image URL:
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.deepai.org/api/creative-upscale"
payload := map[string]string{
"image": "YOUR_IMAGE_URL",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
// Example posting a local image file:
package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
url := "https://api.deepai.org/api/creative-upscale"
var b bytes.Buffer
w := multipart.NewWriter(&b)
imageFile, _ := os.Open("/path/to/your/file.jpg")
defer imageFile.Close()
imageWriter, _ := w.CreateFormFile("image", "file.jpg")
io.Copy(imageWriter, imageFile)
if err := w.Close(); err != nil {
panic(err)
}
req, _ := http.NewRequest("POST", url, &b)
req.Header.Set("Content-Type", w.FormDataContentType())
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
크리에이티브 업스케일 Java 예시
// Example posting a image URL:
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String json = "{" +
"\"image\": \"YOUR_IMAGE_URL\"" +
"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/creative-upscale"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
// Example posting a local image file:
// Add to build.gradle: implementation 'com.squareup.okhttp3:okhttp:4.12.0'
import okhttp3.*;
import java.io.File;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("image", "file.jpg", RequestBody.create(new File("/path/to/your/file.jpg"), MediaType.parse("application/octet-stream")))
.build();
Request request = new Request.Builder()
.url("https://api.deepai.org/api/creative-upscale")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}
}
}
크리에이티브 업스케일 C# 예시
// Example posting a image URL:
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
var payload = new
{
image = "YOUR_IMAGE_URL",
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.deepai.org/api/creative-upscale", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
// Example posting a local image file:
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
using var form = new MultipartFormDataContent();
var imageStream = File.OpenRead("/path/to/your/file.jpg");
form.Add(new StreamContent(imageStream), "image", "file.jpg");
var response = await client.PostAsync("https://api.deepai.org/api/creative-upscale", form);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
크리에이티브 업스케일 Swift 예시
// Example posting a image URL:
import Foundation
let url = URL(string: "https://api.deepai.org/api/creative-upscale")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let payload: [String: Any] = [
"image": "YOUR_IMAGE_URL",
]
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
// Keep the program running for async request
RunLoop.main.run()
// Example posting a local image file:
import Foundation
let url = URL(string: "https://api.deepai.org/api/creative-upscale")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let boundary = UUID().uuidString
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
var body = Data()
let imageData = try! Data(contentsOf: URL(fileURLWithPath: "/path/to/your/file.jpg"))
body.append("--\(boundary)\r\n".data(using: .utf8)!)
body.append("Content-Disposition: form-data; name=\"image\"; filename=\"file.jpg\"\r\n".data(using: .utf8)!)
body.append("Content-Type: application/octet-stream\r\n\r\n".data(using: .utf8)!)
body.append(imageData)
body.append("\r\n".data(using: .utf8)!)
body.append("--\(boundary)--\r\n".data(using: .utf8)!)
request.httpBody = body
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
RunLoop.main.run()
크리에이티브 업스케일 Kotlin 예시
// Example posting a image URL:
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
fun main() {
val client = HttpClient.newHttpClient()
val json = """{
"image": "YOUR_IMAGE_URL"
}"""
val request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/creative-upscale"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
// Example posting a local image file:
// Add to build.gradle.kts: implementation("com.squareup.okhttp3:okhttp:4.12.0")
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody.Companion.asRequestBody
import java.io.File
fun main() {
val client = OkHttpClient()
val requestBody = MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("image", "file.jpg", File("/path/to/your/file.jpg").asRequestBody("application/octet-stream".toMediaType()))
.build()
val request = Request.Builder()
.url("https://api.deepai.org/api/creative-upscale")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build()
client.newCall(request).execute().use { response ->
println(response.body?.string())
}
}
크리에이티브 업스케일 Rust 예시
// Example posting a image URL:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use reqwest::header::HeaderMap;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let mut headers = HeaderMap::new();
headers.insert("api-key", "YOUR_API_KEY".parse()?);
let mut payload = HashMap::new();
payload.insert("image", "YOUR_IMAGE_URL");
let response = client
.post("https://api.deepai.org/api/creative-upscale")
.headers(headers)
.json(&payload)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
// Example posting a local image file:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
use reqwest::multipart;
use std::fs;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let form = multipart::Form::new()
.file("image", "/path/to/your/file.jpg")?;
let response = client
.post("https://api.deepai.org/api/creative-upscale")
.header("api-key", "YOUR_API_KEY")
.multipart(form)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
크리에이티브 업스케일 TypeScript 예시
// Example posting a image URL:
interface ApiResponse {
// Define your response type here
[key: string]: unknown;
}
async function callApi(): Promise<ApiResponse> {
const response = await fetch('https://api.deepai.org/api/creative-upscale', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
image: 'YOUR_IMAGE_URL',
})
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
callApi();
// Example posting a local image file (Node.js with form-data package):
// npm install form-data
import * as fs from 'fs';
import FormData from 'form-data';
interface ApiResponse {
[key: string]: unknown;
}
async function uploadFile(): Promise<ApiResponse> {
const formData = new FormData();
formData.append('image', fs.createReadStream('/path/to/your/file.jpg'));
const response = await fetch('https://api.deepai.org/api/creative-upscale', {
method: 'POST',
headers: {
...formData.getHeaders(),
'api-key': 'YOUR_API_KEY'
},
body: formData as unknown as BodyInit
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
uploadFile();
크리에이티브 업스케일 Dart 예시
// Example posting a image URL:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:convert';
import 'package:http/http.dart' as http;
Future<void> main() async {
final response = await http.post(
Uri.parse('https://api.deepai.org/api/creative-upscale'),
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY',
},
body: jsonEncode({
'image': 'YOUR_IMAGE_URL',
}),
);
print(response.body);
}
// Example posting a local image file:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
var request = http.MultipartRequest(
'POST',
Uri.parse('https://api.deepai.org/api/creative-upscale'),
);
request.headers['api-key'] = 'YOUR_API_KEY';
request.files.add(
await http.MultipartFile.fromPath('image', '/path/to/your/file.jpg'),
);
var response = await request.send();
var responseBody = await response.stream.bytesToString();
print(responseBody);
}
크리에이티브 업스케일 PowerShell 예시
# Example posting a image URL:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/creative-upscale `
-Method Post `
-Form @{
image='YOUR_IMAGE_URL'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
# Example posting a local image file:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/creative-upscale `
-Method Post `
-Form @{
image=Get-Item -Path '/path/to/your/file.jpg'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
AI를 활용해 이미지 속 객체를 교체하고 편집하세요.
엔드포인트: POST https://api.deepai.org/api/image-replace
| 매개변수 | 유형 | 필수 | 기본값 |
|---|---|---|---|
image |
image | 네 | — |
mask |
image | 네 | — |
text |
text | 네 | — |
이미지 교체 cURL 예시
# Example posting a image URL:
curl \
-F 'text=YOUR_TEXT_HERE' \
-F 'mask=YOUR_IMAGE_URL' \
-F 'image=YOUR_IMAGE_URL' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/image-replace
# Example posting a local image file:
curl \
-F 'text=YOUR_TEXT_HERE' \
-F 'mask=@/path/to/your/file.jpg' \
-F 'image=@/path/to/your/file.jpg' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/image-replace
# Example directly sending a text string:
curl \
-F 'text=YOUR_TEXT_HERE' \
-F 'mask=YOUR_TEXT_HERE' \
-F 'image=YOUR_TEXT_HERE' \
-H 'api-key:YOUR_API_KEY' \
https://api.deepai.org/api/image-replace
이미지 교체 Javascript 예시
// Example posting a image URL:
(async function() {
const resp = await fetch('https://api.deepai.org/api/image-replace', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
text: "YOUR_TEXT_HERE",
mask: "YOUR_IMAGE_URL",
image: "YOUR_IMAGE_URL",
})
});
const data = await resp.json();
console.log(data);
})()
// Example posting file picker input image (Browser only):
document.getElementById('yourFileInputId').addEventListener('change', async function() {
const formData = new FormData();
formData.append('text', 'YOUR_TEXT_HERE');
formData.append('mask', this.files[0]);
formData.append('image', this.files[1]);
const resp = await fetch('https://api.deepai.org/api/image-replace', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
// Example posting a local image file (Node.js only):
const fs = require('fs');
(async function() {
const formData = new FormData();
formData.append('text', 'YOUR_TEXT_HERE');
const jpgFileStream = fs.createReadStream("/path/to/your/file.jpg");
formData.append('mask', jpgFileStream);
const jpgFileStream = fs.createReadStream("/path/to/your/file.jpg");
formData.append('image', jpgFileStream);
const resp = await fetch('https://api.deepai.org/api/image-replace', {
method: 'POST',
headers: {
'api-key': 'YOUR_API_KEY'
},
body: formData
});
const data = await resp.json();
console.log(data);
});
// Example directly sending a text string:
(async function() {
const resp = await fetch('https://api.deepai.org/api/image-replace', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
text: "YOUR_TEXT_HERE",
mask: "YOUR_TEXT_HERE",
image: "YOUR_TEXT_HERE",
})
});
const data = await resp.json();
console.log(data);
})()
이미지 교체 Python 예시
# Example posting a image URL:
import requests
r = requests.post(
"https://api.deepai.org/api/image-replace",
data={
'text': 'YOUR_TEXT_HERE',
'mask': 'YOUR_IMAGE_URL',
'image': 'YOUR_IMAGE_URL',
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
# Example posting a local image file:
import requests
r = requests.post(
"https://api.deepai.org/api/image-replace",
files={
'mask': open('/path/to/your/file.jpg', 'rb'),
'image': open('/path/to/your/file.jpg', 'rb'),
},
data={
'text': 'YOUR_TEXT_HERE',
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
# Example directly sending a text string:
import requests
r = requests.post(
"https://api.deepai.org/api/image-replace",
data={
'text': 'YOUR_TEXT_HERE',
'mask': 'YOUR_TEXT_HERE',
'image': 'YOUR_TEXT_HERE',
},
headers={'api-key': 'YOUR_API_KEY'}
)
print(r.json())
이미지 교체 Ruby 예시
# Example posting a image URL:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/image-replace', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'text' => 'YOUR_TEXT_HERE',
'mask' => 'YOUR_IMAGE_URL',
'image' => 'YOUR_IMAGE_URL',
}
)
puts r
# Example posting a local image file:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/image-replace', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'text' => 'YOUR_TEXT_HERE',
'mask' => File.new('/path/to/your/file.jpg'),
'image' => File.new('/path/to/your/file.jpg'),
}
)
puts r
# Example directly sending a text string:
require 'rest_client'
r = RestClient::Request.execute(method: :post, url: 'https://api.deepai.org/api/image-replace', timeout: 600,
headers: {'api-key' => 'YOUR_API_KEY'},
payload: {
'text' => 'YOUR_TEXT_HERE',
'mask' => 'YOUR_TEXT_HERE',
'image' => 'YOUR_TEXT_HERE',
}
)
puts r
이미지 교체 Php 예시
// Example posting a image URL:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'text',
'contents' => 'YOUR_TEXT_HERE'
],
[
'name' => 'mask',
'contents' => 'YOUR_IMAGE_URL'
],
[
'name' => 'image',
'contents' => 'YOUR_IMAGE_URL'
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/image-replace', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
// Example posting a local image file:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'text',
'contents' => 'YOUR_TEXT_HERE'
],
[
'name' => 'mask',
'contents' => Utils::tryFopen('/path/to/your/file.jpg', 'r')
],
[
'name' => 'image',
'contents' => Utils::tryFopen('/path/to/your/file.jpg', 'r')
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/image-replace', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
// Example directly sending a text string:
<?php
require 'vendor/autoload.php'; // Ensure you have Guzzle installed (composer require guzzlehttp/guzzle)
use GuzzleHttp\Client;
use GuzzleHttp\Psr7\Utils;
$client = new Client();
$headers = [
'api-key' => 'YOUR_API_KEY'
];
$options = [
'multipart' => [
[
'name' => 'text',
'contents' => 'YOUR_TEXT_HERE'
],
[
'name' => 'mask',
'contents' => 'YOUR_TEXT_HERE'
],
[
'name' => 'image',
'contents' => 'YOUR_TEXT_HERE'
],
]
];
$request = new GuzzleHttp\Psr7\Request('POST', 'https://api.deepai.org/api/image-replace', $headers);
try {
$res = $client->sendAsync($request, $options)->wait();
echo $res->getBody();
} catch (Exception $e) {
echo 'Error: ' . $e->getMessage();
}
?>
이미지 교체 Go 예시
// Example posting a image URL:
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.deepai.org/api/image-replace"
payload := map[string]string{
"text": "YOUR_TEXT_HERE",
"mask": "YOUR_IMAGE_URL",
"image": "YOUR_IMAGE_URL",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
// Example posting a local image file:
package main
import (
"bytes"
"fmt"
"io"
"mime/multipart"
"net/http"
"os"
)
func main() {
url := "https://api.deepai.org/api/image-replace"
var b bytes.Buffer
w := multipart.NewWriter(&b)
w.WriteField("text", "YOUR_TEXT_HERE")
maskFile, _ := os.Open("/path/to/your/file.jpg")
defer maskFile.Close()
maskWriter, _ := w.CreateFormFile("mask", "file.jpg")
io.Copy(maskWriter, maskFile)
imageFile, _ := os.Open("/path/to/your/file.jpg")
defer imageFile.Close()
imageWriter, _ := w.CreateFormFile("image", "file.jpg")
io.Copy(imageWriter, imageFile)
if err := w.Close(); err != nil {
panic(err)
}
req, _ := http.NewRequest("POST", url, &b)
req.Header.Set("Content-Type", w.FormDataContentType())
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
// Example directly sending a text string:
package main
import (
"bytes"
"encoding/json"
"fmt"
"io"
"net/http"
)
func main() {
url := "https://api.deepai.org/api/image-replace"
payload := map[string]string{
"text": "YOUR_TEXT_HERE",
"mask": "YOUR_TEXT_HERE",
"image": "YOUR_TEXT_HERE",
}
jsonData, _ := json.Marshal(payload)
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(jsonData))
req.Header.Set("Content-Type", "application/json")
req.Header.Set("api-key", "YOUR_API_KEY")
client := &http.Client{}
resp, err := client.Do(req)
if err != nil {
panic(err)
}
defer resp.Body.Close()
body, _ := io.ReadAll(resp.Body)
fmt.Println(string(body))
}
이미지 교체 Java 예시
// Example posting a image URL:
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String json = "{" +
"\"text\": \"YOUR_TEXT_HERE\"" +
"\"mask\": \"YOUR_IMAGE_URL\"" +
"\"image\": \"YOUR_IMAGE_URL\"" +
"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/image-replace"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
// Example posting a local image file:
// Add to build.gradle: implementation 'com.squareup.okhttp3:okhttp:4.12.0'
import okhttp3.*;
import java.io.File;
import java.io.IOException;
public class Main {
public static void main(String[] args) throws IOException {
OkHttpClient client = new OkHttpClient();
RequestBody requestBody = new MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("text", "YOUR_TEXT_HERE")
.addFormDataPart("mask", "file.jpg", RequestBody.create(new File("/path/to/your/file.jpg"), MediaType.parse("application/octet-stream")))
.addFormDataPart("image", "file.jpg", RequestBody.create(new File("/path/to/your/file.jpg"), MediaType.parse("application/octet-stream")))
.build();
Request request = new Request.Builder()
.url("https://api.deepai.org/api/image-replace")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build();
try (Response response = client.newCall(request).execute()) {
System.out.println(response.body().string());
}
}
}
// Example directly sending a text string:
import java.net.http.HttpClient;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
import java.net.URI;
public class Main {
public static void main(String[] args) throws Exception {
HttpClient client = HttpClient.newHttpClient();
String json = "{" +
"\"text\": \"YOUR_TEXT_HERE\"" +
"\"mask\": \"YOUR_TEXT_HERE\"" +
"\"image\": \"YOUR_TEXT_HERE\"" +
"}";
HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/image-replace"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build();
HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
}
}
이미지 교체 C# 예시
// Example posting a image URL:
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
var payload = new
{
text = "YOUR_TEXT_HERE",
mask = "YOUR_IMAGE_URL",
image = "YOUR_IMAGE_URL",
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.deepai.org/api/image-replace", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
// Example posting a local image file:
using System;
using System.IO;
using System.Net.Http;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
using var form = new MultipartFormDataContent();
form.Add(new StringContent("YOUR_TEXT_HERE"), "text");
var maskStream = File.OpenRead("/path/to/your/file.jpg");
form.Add(new StreamContent(maskStream), "mask", "file.jpg");
var imageStream = File.OpenRead("/path/to/your/file.jpg");
form.Add(new StreamContent(imageStream), "image", "file.jpg");
var response = await client.PostAsync("https://api.deepai.org/api/image-replace", form);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
// Example directly sending a text string:
using System;
using System.Net.Http;
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
class Program
{
static async Task Main()
{
using var client = new HttpClient();
client.DefaultRequestHeaders.Add("api-key", "YOUR_API_KEY");
var payload = new
{
text = "YOUR_TEXT_HERE",
mask = "YOUR_TEXT_HERE",
image = "YOUR_TEXT_HERE",
};
var json = JsonSerializer.Serialize(payload);
var content = new StringContent(json, Encoding.UTF8, "application/json");
var response = await client.PostAsync("https://api.deepai.org/api/image-replace", content);
var result = await response.Content.ReadAsStringAsync();
Console.WriteLine(result);
}
}
이미지 교체 Swift 예시
// Example posting a image URL:
import Foundation
let url = URL(string: "https://api.deepai.org/api/image-replace")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let payload: [String: Any] = [
"text": "YOUR_TEXT_HERE",
"mask": "YOUR_IMAGE_URL",
"image": "YOUR_IMAGE_URL",
]
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
// Keep the program running for async request
RunLoop.main.run()
// Example posting a local image file:
import Foundation
let url = URL(string: "https://api.deepai.org/api/image-replace")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let boundary = UUID().uuidString
request.setValue("multipart/form-data; boundary=\(boundary)", forHTTPHeaderField: "Content-Type")
var body = Data()
body.append("--\(boundary)\r\n".data(using: .utf8)!)
body.append("Content-Disposition: form-data; name=\"text\"\r\n\r\n".data(using: .utf8)!)
body.append("YOUR_TEXT_HERE".data(using: .utf8)!)
body.append("\r\n".data(using: .utf8)!)
let maskData = try! Data(contentsOf: URL(fileURLWithPath: "/path/to/your/file.jpg"))
body.append("--\(boundary)\r\n".data(using: .utf8)!)
body.append("Content-Disposition: form-data; name=\"mask\"; filename=\"file.jpg\"\r\n".data(using: .utf8)!)
body.append("Content-Type: application/octet-stream\r\n\r\n".data(using: .utf8)!)
body.append(maskData)
body.append("\r\n".data(using: .utf8)!)
let imageData = try! Data(contentsOf: URL(fileURLWithPath: "/path/to/your/file.jpg"))
body.append("--\(boundary)\r\n".data(using: .utf8)!)
body.append("Content-Disposition: form-data; name=\"image\"; filename=\"file.jpg\"\r\n".data(using: .utf8)!)
body.append("Content-Type: application/octet-stream\r\n\r\n".data(using: .utf8)!)
body.append(imageData)
body.append("\r\n".data(using: .utf8)!)
body.append("--\(boundary)--\r\n".data(using: .utf8)!)
request.httpBody = body
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
RunLoop.main.run()
// Example directly sending a text string:
import Foundation
let url = URL(string: "https://api.deepai.org/api/image-replace")!
var request = URLRequest(url: url)
request.httpMethod = "POST"
request.setValue("application/json", forHTTPHeaderField: "Content-Type")
request.setValue("YOUR_API_KEY", forHTTPHeaderField: "api-key")
let payload: [String: Any] = [
"text": "YOUR_TEXT_HERE",
"mask": "YOUR_TEXT_HERE",
"image": "YOUR_TEXT_HERE",
]
request.httpBody = try? JSONSerialization.data(withJSONObject: payload)
let task = URLSession.shared.dataTask(with: request) { data, response, error in
if let data = data {
print(String(data: data, encoding: .utf8) ?? "")
}
}
task.resume()
RunLoop.main.run()
이미지 교체 Kotlin 예시
// Example posting a image URL:
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
fun main() {
val client = HttpClient.newHttpClient()
val json = """{
"text": "YOUR_TEXT_HERE",
"mask": "YOUR_IMAGE_URL",
"image": "YOUR_IMAGE_URL"
}"""
val request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/image-replace"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
// Example posting a local image file:
// Add to build.gradle.kts: implementation("com.squareup.okhttp3:okhttp:4.12.0")
import okhttp3.*
import okhttp3.MediaType.Companion.toMediaType
import okhttp3.RequestBody.Companion.asRequestBody
import java.io.File
fun main() {
val client = OkHttpClient()
val requestBody = MultipartBody.Builder()
.setType(MultipartBody.FORM)
.addFormDataPart("text", "YOUR_TEXT_HERE")
.addFormDataPart("mask", "file.jpg", File("/path/to/your/file.jpg").asRequestBody("application/octet-stream".toMediaType()))
.addFormDataPart("image", "file.jpg", File("/path/to/your/file.jpg").asRequestBody("application/octet-stream".toMediaType()))
.build()
val request = Request.Builder()
.url("https://api.deepai.org/api/image-replace")
.addHeader("api-key", "YOUR_API_KEY")
.post(requestBody)
.build()
client.newCall(request).execute().use { response ->
println(response.body?.string())
}
}
// Example directly sending a text string:
import java.net.URI
import java.net.http.HttpClient
import java.net.http.HttpRequest
import java.net.http.HttpResponse
fun main() {
val client = HttpClient.newHttpClient()
val json = """{
"text": "YOUR_TEXT_HERE",
"mask": "YOUR_TEXT_HERE",
"image": "YOUR_TEXT_HERE"
}"""
val request = HttpRequest.newBuilder()
.uri(URI.create("https://api.deepai.org/api/image-replace"))
.header("Content-Type", "application/json")
.header("api-key", "YOUR_API_KEY")
.POST(HttpRequest.BodyPublishers.ofString(json))
.build()
val response = client.send(request, HttpResponse.BodyHandlers.ofString())
println(response.body())
}
이미지 교체 Rust 예시
// Example posting a image URL:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use reqwest::header::HeaderMap;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let mut headers = HeaderMap::new();
headers.insert("api-key", "YOUR_API_KEY".parse()?);
let mut payload = HashMap::new();
payload.insert("text", "YOUR_TEXT_HERE");
payload.insert("mask", "YOUR_IMAGE_URL");
payload.insert("image", "YOUR_IMAGE_URL");
let response = client
.post("https://api.deepai.org/api/image-replace")
.headers(headers)
.json(&payload)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
// Example posting a local image file:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
use reqwest::multipart;
use std::fs;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let form = multipart::Form::new()
.text("text", "YOUR_TEXT_HERE")
.file("mask", "/path/to/your/file.jpg")?
.file("image", "/path/to/your/file.jpg")?;
let response = client
.post("https://api.deepai.org/api/image-replace")
.header("api-key", "YOUR_API_KEY")
.multipart(form)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
// Example directly sending a text string:
// Add to Cargo.toml: reqwest = { version = "0.11", features = ["json", "multipart"] }
// tokio = { version = "1", features = ["full"] }
// serde_json = "1"
use reqwest::header::HeaderMap;
use std::collections::HashMap;
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client = reqwest::Client::new();
let mut headers = HeaderMap::new();
headers.insert("api-key", "YOUR_API_KEY".parse()?);
let mut payload = HashMap::new();
payload.insert("text", "YOUR_TEXT_HERE");
payload.insert("mask", "YOUR_TEXT_HERE");
payload.insert("image", "YOUR_TEXT_HERE");
let response = client
.post("https://api.deepai.org/api/image-replace")
.headers(headers)
.json(&payload)
.send()
.await?;
println!("{}", response.text().await?);
Ok(())
}
이미지 교체 TypeScript 예시
// Example posting a image URL:
interface ApiResponse {
// Define your response type here
[key: string]: unknown;
}
async function callApi(): Promise<ApiResponse> {
const response = await fetch('https://api.deepai.org/api/image-replace', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
text: 'YOUR_TEXT_HERE',
mask: 'YOUR_IMAGE_URL',
image: 'YOUR_IMAGE_URL',
})
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
callApi();
// Example posting a local image file (Node.js with form-data package):
// npm install form-data
import * as fs from 'fs';
import FormData from 'form-data';
interface ApiResponse {
[key: string]: unknown;
}
async function uploadFile(): Promise<ApiResponse> {
const formData = new FormData();
formData.append('text', 'YOUR_TEXT_HERE');
formData.append('mask', fs.createReadStream('/path/to/your/file.jpg'));
formData.append('image', fs.createReadStream('/path/to/your/file.jpg'));
const response = await fetch('https://api.deepai.org/api/image-replace', {
method: 'POST',
headers: {
...formData.getHeaders(),
'api-key': 'YOUR_API_KEY'
},
body: formData as unknown as BodyInit
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
uploadFile();
// Example directly sending a text string:
interface ApiResponse {
[key: string]: unknown;
}
async function callApi(): Promise<ApiResponse> {
const response = await fetch('https://api.deepai.org/api/image-replace', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY'
},
body: JSON.stringify({
text: 'YOUR_TEXT_HERE',
mask: 'YOUR_TEXT_HERE',
image: 'YOUR_TEXT_HERE',
})
});
const data: ApiResponse = await response.json();
console.log(data);
return data;
}
callApi();
이미지 교체 Dart 예시
// Example posting a image URL:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:convert';
import 'package:http/http.dart' as http;
Future<void> main() async {
final response = await http.post(
Uri.parse('https://api.deepai.org/api/image-replace'),
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY',
},
body: jsonEncode({
'text': 'YOUR_TEXT_HERE',
'mask': 'YOUR_IMAGE_URL',
'image': 'YOUR_IMAGE_URL',
}),
);
print(response.body);
}
// Example posting a local image file:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:io';
import 'package:http/http.dart' as http;
Future<void> main() async {
var request = http.MultipartRequest(
'POST',
Uri.parse('https://api.deepai.org/api/image-replace'),
);
request.headers['api-key'] = 'YOUR_API_KEY';
request.fields['text'] = 'YOUR_TEXT_HERE';
request.files.add(
await http.MultipartFile.fromPath('mask', '/path/to/your/file.jpg'),
);
request.files.add(
await http.MultipartFile.fromPath('image', '/path/to/your/file.jpg'),
);
var response = await request.send();
var responseBody = await response.stream.bytesToString();
print(responseBody);
}
// Example directly sending a text string:
// Add to pubspec.yaml: http: ^1.1.0
import 'dart:convert';
import 'package:http/http.dart' as http;
Future<void> main() async {
final response = await http.post(
Uri.parse('https://api.deepai.org/api/image-replace'),
headers: {
'Content-Type': 'application/json',
'api-key': 'YOUR_API_KEY',
},
body: jsonEncode({
'text': 'YOUR_TEXT_HERE',
'mask': 'YOUR_TEXT_HERE',
'image': 'YOUR_TEXT_HERE',
}),
);
print(response.body);
}
이미지 교체 PowerShell 예시
# Example posting a image URL:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/image-replace `
-Method Post `
-Form @{
text='YOUR_TEXT_HERE'
mask='YOUR_IMAGE_URL'
image='YOUR_IMAGE_URL'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
# Example posting a local image file:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/image-replace `
-Method Post `
-Form @{
text='YOUR_TEXT_HERE'
mask=Get-Item -Path '/path/to/your/file.jpg'
image=Get-Item -Path '/path/to/your/file.jpg'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
# Example directly sending a text string:
$r = Invoke-WebRequest `
-Uri https://api.deepai.org/api/image-replace `
-Method Post `
-Form @{
text='YOUR_TEXT_HERE'
mask='YOUR_TEXT_HERE'
image='YOUR_TEXT_HERE'
} `
-Headers @{
'api-key'='YOUR_API_KEY'
}
$r.Content
Google 계정을 사용하여 DeepAI에 로그인하세요