> For the complete documentation index, see [llms.txt](https://docs.roboflow.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.roboflow.com/roboflow/roboflow-ko/guides/run-model-serverless-api.md).

# Model API Endpoint 사용

해당 [Serverless Hosted API](/roboflow/roboflow-ko/deploy/serverless-hosted-api-v2.md) Roboflow의 클라우드에서 GPUs에서 models와 Workflows를 실행합니다. 이미지를 보내면 결과를 돌려받습니다. 설정할 hardware도, 계속 실행해 둘 server도 없습니다.

이 가이드는 5분 만에 모델을 실행하는 단계까지 안내합니다. 이미지 안의 객체를 이름만 붙여 찾아내고, 즉시 사용할 수 있는 모델로 일상적인 객체를 감지하며, 동일한 Serverless API endpoint를 통해 자신만의 모델도 실행할 수 있습니다.

## 이름을 붙여 객체 찾기

모델에 다음과 같은 몇 개의 단어를 입력하세요 `"taxi"`, `"blue bus"`또는 `"bush"` 그러면 이미지에서 일치하는 모든 객체의 윤곽을 표시합니다. 먼저 설정하거나 학습할 것은 없습니다. 이것은 실행됩니다 [SAM3](/roboflow/roboflow-ko/deploy/supported-models/sam3.md).

{% tabs %}
{% tab title="HTTP (Python)" icon="webhook" %}
{% stepper %}
{% step %}

### API Key를 받으세요

Roboflow 계정을 만들고, 다음에서 키를 찾으세요: [Roboflow API 설정 페이지](https://app.roboflow.com/settings/api) 그리고 이를 셸에서 사용할 수 있도록 설정하세요:

```bash
export ROBOFLOW_API_KEY="your-key-here"
```

{% endstep %}

{% step %}

### 종속성을 설치하세요

`supervision` 가져옵니다 `cv2` 및 `numpy`:

```bash
pip install supervision
```

{% endstep %}

{% step %}

### 모델을 실행하세요

다음으로 POST 요청을 보내세요 `/sam3/concept_segment` 모델을 실행합니다. `sv.Detections.from_sam3` 그 결과를 다음과 같은 형식으로 변환합니다 [`supervision`](https://supervision.roboflow.com) 그릴 수 있습니다:

```python
import os
import base64
import cv2
import requests
import supervision as sv
import numpy as np

content = requests.get("https://media.roboflow.com/quickstart/traffic.jpg").content
image = cv2.imdecode(np.frombuffer(content, np.uint8), cv2.IMREAD_COLOR)
image_b64 = base64.b64encode(content).decode("utf-8")
h, w = image.shape[:2]

response = requests.post(
    "https://serverless.roboflow.com/sam3/concept_segment",
    params={"api_key": os.environ["ROBOFLOW_API_KEY"]},
    json={
        "image": {"type": "base64", "value": image_b64},
        "prompts": [
            {"type": "text", "text": "taxi"},
            {"type": "text", "text": "blue bus"},
            {"type": "text", "text": "bush"},
        ],
    },
)

detections = sv.Detections.from_sam3(response.json(), (w, h))
annotated = sv.MaskAnnotator().annotate(image.copy(), detections)
cv2.imwrite("sam3.jpg", annotated)
```

{% endstep %}
{% endstepper %}
{% endtab %}

{% tab title="SDK (Python)" icon="python" %}
{% stepper %}
{% step %}

### API Key를 받으세요

Roboflow 계정을 만들고, 다음에서 키를 찾으세요: [Roboflow API 설정 페이지](https://app.roboflow.com/settings/api) 그리고 이를 셸에서 사용할 수 있도록 설정하세요:

```bash
export ROBOFLOW_API_KEY="your-key-here"
```

{% endstep %}

{% step %}

### 종속성을 설치하세요

이 두 패키지는 모델을 호출하고 결과를 그립니다:

```bash
pip install inference-sdk supervision
```

{% endstep %}

{% step %}

### 모델을 실행하세요

해당 [Inference SDK](https://inference.roboflow.com/inference_helpers/inference_sdk/) 이미지를 클라우드로 보내고 결과를 반환합니다. `sv.Detections.from_sam3` 그 결과를 다음과 같은 형식으로 변환합니다 [`supervision`](https://supervision.roboflow.com) 그릴 수 있습니다:

```python
import os
import cv2
import numpy as np
import requests
import supervision as sv
from inference_sdk import InferenceHTTPClient

content = requests.get("https://media.roboflow.com/quickstart/traffic.jpg").content
image = cv2.imdecode(np.frombuffer(content, np.uint8), cv2.IMREAD_COLOR)
h, w = image.shape[:2]

client = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key=os.environ["ROBOFLOW_API_KEY"],
)

data = client.sam3_concept_segment(
    image,
    prompts=[
        {"type": "text", "text": "taxi"},
        {"type": "text", "text": "blue bus"},
        {"type": "text", "text": "bush"},
    ],
)

detections = sv.Detections.from_sam3(data, (w, h))
annotated = sv.MaskAnnotator().annotate(image.copy(), detections)
annotated = sv.BoxAnnotator().annotate(annotated, detections)
cv2.imwrite("sam3.jpg", annotated)
```

{% endstep %}
{% endstepper %}
{% endtab %}
{% endtabs %}

응답에는 각 프롬프트에 대해 발견된 윤곽이 나열되며, 각 항목마다 신뢰도 점수가 있습니다. `sv.Detections.from_sam3` 그 모든 내용을 대신 읽어 줍니다.

<figure><img src="/files/41962ece8a9ad8d3885e74149c43f2af9dd1e884" alt="Outlines around taxis, a blue bus, and bushes from text prompts"><figcaption><p>텍스트 프롬프트에서 윤곽이 표시된 객체</p></figcaption></figure>

visual prompts, exemplar boxes, RLE output를 포함한 전체 SAM3 API는 다음을 참조하세요 [SAM3 문서](/roboflow/roboflow-ko/deploy/supported-models/sam3.md).

## 사전 제작된 모델로 일상적인 객체 감지하기

{% tabs %}
{% tab title="HTTP (Python)" icon="webhook" %}
일반 객체 주위에 박스를 그리려면, 이름이 붙은 객체 윤곽을 표시하는 대신 다음을 호출하세요 `POST /{project}/{version}` 다음이 아니라 모델 ID를 사용하여 `POST /sam3/concept_segment`. 이 예제는 사전 제작된 [RF-DETR](/roboflow/roboflow-ko/deploy/supported-models/rf-detr.md) 모델을 사용합니다. 이 모델은 차량, 사람, 반려동물 같은 일반 객체를 감지할 수 있습니다:

```python
result = requests.post(
    "https://serverless.roboflow.com/coco/40",  # coco/40은 rfdetr-medium의 별칭입니다
    params={"api_key": os.environ["ROBOFLOW_API_KEY"]},
    data=image_b64,  # 본문에 원시 base64를 넣으며, JSON이 아닙니다
    headers={"Content-Type": "application/x-www-form-urlencoded"},
).json()
detections = sv.Detections.from_inference(result)

print(f"객체 {len(detections)}개를 찾았습니다")

annotated = sv.BoxAnnotator().annotate(image.copy(), detections)
annotated = sv.LabelAnnotator().annotate(annotated, detections)
cv2.imwrite("rf-detr.jpg", annotated)
```

{% endtab %}

{% tab title="SDK (Python)" icon="python" %}
일반 객체 주위에 박스를 그리려면, 이름이 붙은 객체 윤곽을 표시하는 대신 다음을 호출하세요 `client.infer()` 다음이 아니라 모델 ID를 사용하여 `client.sam3_concept_segment()`. 이 예제는 사전 제작된 [RF-DETR](/roboflow/roboflow-ko/deploy/supported-models/rf-detr.md) 모델을 사용합니다. 이 모델은 차량, 사람, 반려동물 같은 일반 객체를 감지할 수 있습니다:

```python
result = client.infer(image, model_id="rfdetr-medium")
detections = sv.Detections.from_inference(result)

print(f"객체 {len(detections)}개를 찾았습니다")

annotated = sv.BoxAnnotator().annotate(image.copy(), detections)
annotated = sv.LabelAnnotator().annotate(annotated, detections)
cv2.imwrite("rf-detr.jpg", annotated)
```

{% endtab %}
{% endtabs %}

<figure><img src="/files/25c5309335bd82dc12969cd302e2164558eef839" alt="RF-DETR bounding boxes for cars, buses, people, and motorcycles"><figcaption><p>RF-DETR이 자동차, 버스, 사람, 오토바이를 감지합니다</p></figcaption></figure>

## 자신의 모델이나 다른 모델을 실행하기

동일한 `client.infer()` 또는 `POST /{project}/{version}` 호출은 해당 모델 ID로 어떤 모델이든 실행합니다 `model_id`:

* Roboflow에서 학습한 model. model ID를 복사하세요(형식은 `{project}/{version}`이며) [Roboflow 앱](https://app.roboflow.com)
* 의 공개 model [Roboflow Universe](/roboflow/roboflow-ko/universe/what-is-roboflow-universe.md)
* 사전 제작된 [사전 학습된 model](https://inference.roboflow.com/quickstart/aliases/) 예를 들어 다음과 같은 별칭으로 `rfdetr-nano`, `rfdetr-seg-medium`또는 `yolo26l-640` (inference SDK 전용)

## 다음 단계

클라우드에서 모델을 실행하고 있습니다. 여기에서 다음을 할 수 있습니다:

* 동일한 모델을 자체 하드웨어에서 실행하세요. 다음을 참조하세요 [모델을 로컬에서 실행하기](/roboflow/roboflow-ko/guides/run-a-model-locally.md)
* 대형 모델과 안정적인 트래픽을 위한 private, single-tenant endpoint를 얻으세요 [Dedicated Deployments](/roboflow/roboflow-ko/deploy/dedicated-deployments.md)
* 모델과 로직을 애플리케이션으로 연결하려면 다음을 사용하세요 [Workflows](/roboflow/roboflow-ko/workflows/what-is-workflows.md)
* 각 요청에 드는 비용을 다음에서 확인하세요 [Serverless 가격 페이지](/roboflow/roboflow-ko/deploy/serverless-hosted-api-v2/pricing.md)
