> 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/get-started/hi/guides/run-model-serverless-api.md).

# मॉडल API एंडपॉइंट का उपयोग करें

Roboflow के क्लाउड GPU पर पाँच मिनट में एक मॉडल चलाएँ, बिना किसी हार्डवेयर सेटअप के।

यह [Serverless Cloud API](https://docs.roboflow.com/deployment/roboflow-cloud/serverless-api) Roboflow के क्लाउड में GPU पर मॉडल और वर्कफ़्लो चलाता है। आप एक इमेज भेजते हैं और परिणाम वापस पाते हैं। न तो हार्डवेयर सेट अप करना पड़ता है, न ही सर्वर को लगातार चालू रखना पड़ता है।

यह गाइड आपको पाँच मिनट में शुरुआत से मॉडल चलाने तक पहुँचाती है। आप सिर्फ़ उनके नाम बताकर इमेज में ऑब्जेक्ट ढूँढ़ेंगे, पहले से तैयार मॉडल से रोज़मर्रा की वस्तुओं का पता लगाएँगे और अपने मॉडल चलाएँगे—ये सब एक ही Serverless Cloud API एंडपॉइंट के ज़रिए।

## नाम बताकर ऑब्जेक्ट ढूँढ़ें

मॉडल को कुछ शब्द दें, जैसे `"taxi"`, `"blue bus"`, या `"bush"` और यह इमेज में मेल खाने वाले हर ऑब्जेक्ट की रूपरेखा बना देता है। पहले कुछ सेट अप करने या ट्रेन करने की ज़रूरत नहीं है। यह [SAM3](https://docs.roboflow.com/models/supported-models/sam3).

{% 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 -U supervision
```

{% endstep %}

{% step %}

### मॉडल चलाएँ

मॉडल चलाने के लिए `/sam3/concept_segment` को POST अनुरोध भेजें। `sv.Detections.from_sam3` उन परिणामों को ऐसे फ़ॉर्मैट में बदलता है [`supervision`](https://supervision.roboflow.com) जिसे ड्रॉ कर सकता है:

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

image = sv.load_image_from_url("https://media.roboflow.com/quickstart/traffic.jpg")
image_b64 = base64.b64encode(content).decode("utf-8")
h, w = image.shape[:2]

response = requests.post(
    "https://serverless.roboflow.com/sam3/concept_segment",
    headers={"Authorization": f"Bearer {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 -U inference-sdk supervision
```

{% endstep %}

{% step %}

### मॉडल चलाएँ

यह [Inference SDK](https://docs.roboflow.com/reference/inference/inference-sdk) आपकी इमेज क्लाउड पर भेजता है और परिणाम लौटाता है। `sv.Detections.from_sam3` उन परिणामों को ऐसे फ़ॉर्मैट में बदलता है [`supervision`](https://supervision.roboflow.com) यह बना सकता है:

```python
import os
import cv2
import supervision as sv
from inference_sdk import InferenceHTTPClient, InferenceConfiguration

image = sv.load_image_from_url("https://media.roboflow.com/quickstart/traffic.jpg")
h, w = image.shape[:2]

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

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 %}

जवाब में हर प्रॉम्प्ट के लिए मिले आउटलाइन की सूची होती है और हर एक के लिए confidence score भी दिया जाता है। `sv.Detections.from_sam3` यह सब आपके लिए पढ़ता है।

<figure><img src="https://3949523067-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1YMZNIiZMBdlCHUDeZMP%2Fuploads%2Fgit-blob-fc88d211337fc1990e06fab3fc499075fdedd7c1%2Fserverless-sam3-out.jpg?alt=media" alt="Outlines around taxis, a blue bus, and bushes from text prompts"><figcaption><p>टेक्स्ट प्रॉम्प्ट से आउटलाइन की गई वस्तुएँ</p></figcaption></figure>

विज़ुअल प्रॉम्प्ट, उदाहरण बॉक्स और RLE आउटपुट सहित SAM3 API की पूरी जानकारी के लिए देखें [SAM3 दस्तावेज़](https://docs.roboflow.com/models/supported-models/sam3).

## तैयार मॉडल से रोज़मर्रा की वस्तुओं का पता लगाएँ

{% tabs %}
{% tab title="HTTP (Python)" icon="webhook" %}
नाम लेकर बताई गई वस्तुओं की आउटलाइन बनाने के बजाय आम वस्तुओं के चारों ओर बॉक्स बनाने के लिए, यह कॉल करें `POST /{project}/{version}` और इसकी जगह मॉडल ID दें `POST /sam3/concept_segment`. इस उदाहरण में तैयार [RF-DETR](https://docs.roboflow.com/models/supported-models/rf-detr) मॉडल का इस्तेमाल किया गया है, जो वाहन, लोगों और पालतू जानवरों जैसी आम वस्तुओं का पता लगा सकता है। RF-DETR Apache 2.0 लाइसेंस के तहत है, इसलिए व्यावसायिक इस्तेमाल के लिए मुफ़्त है:

```python
result = requests.post(
    "https://serverless.roboflow.com/coco/40",  # coco/40 rfdetr-medium का उपनाम है
    data=image_b64,  # अनुरोध के मुख्य भाग में सीधे base64, JSON नहीं
    headers={
        "Authorization": f"Bearer {os.environ['ROBOFLOW_API_KEY']}",
        "Content-Type": "application/x-www-form-urlencoded",
    },
).json()
detections = sv.Detections.from_inference(result)

print(f"Found {len(detections)} objects")

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](https://docs.roboflow.com/models/supported-models/rf-detr) मॉडल का इस्तेमाल किया गया है, जो वाहन, लोगों और पालतू जानवरों जैसी आम वस्तुओं का पता लगा सकता है। RF-DETR Apache 2.0 लाइसेंस के तहत है, इसलिए व्यावसायिक इस्तेमाल के लिए मुफ़्त है:

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

print(f"Found {len(detections)} objects")

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

{% endtab %}
{% endtabs %}

<figure><img src="https://3949523067-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1YMZNIiZMBdlCHUDeZMP%2Fuploads%2Fgit-blob-516089a73418852ced8eddbeeb1a94db1bc11421%2Fserverless-rfdetr-out.jpg?alt=media" alt="RF-DETR bounding boxes for cars, buses, people, and motorcycles"><figcaption><p>RF-DETR कारों, बसों, लोगों और मोटरसाइकिलों का पता लगाता है</p></figcaption></figure>

## अपना या कोई दूसरा मॉडल चलाएँ

वही `client.infer()` या `POST /{project}/{version}` कॉल किसी भी मॉडल को उसके `model_id`:

* से चलाती है। Roboflow में आपके द्वारा प्रशिक्षित मॉडल। उसका मॉडल ID कॉपी करें (जिसका प्रारूप है `{project}/{version}`) को अपने प्रोजेक्ट से [Roboflow ऐप](https://app.roboflow.com)
* का सार्वजनिक मॉडल [Roboflow Universe](https://docs.roboflow.com/datasets/universe/universe/what-is-roboflow-universe)
* एक तैयार-इस्तेमाल के लिए उपलब्ध [प्रीट्रेन्ड मॉडल](https://docs.roboflow.com/models/pretrained-aliases) उपनाम से, जैसे `rfdetr-nano`, `rfdetr-seg-medium`, या `yolo26l-640` (केवल inference SDK के लिए)। RF-DETR Apache 2.0 लाइसेंस के अंतर्गत है; YOLO26 AGPL-3.0 के अंतर्गत है, और Roboflow पर डिप्लॉय करने पर इसमें व्यावसायिक लाइसेंस शामिल होता है। देखें [मॉडल लाइसेंस](https://docs.roboflow.com/models/model-licenses)

## आगे क्या करें

आप क्लाउड में मॉडल चला रहे हैं। यहाँ से आप ये कर सकते हैं:

* इन्हीं मॉडलों को अपने हार्डवेयर पर चलाएँ। देखें [मॉडल को स्थानीय रूप से चलाएँ](https://docs.roboflow.com/get-started/hi/guides/run-a-model-locally.md)
* बड़े मॉडलों और स्थिर ट्रैफ़िक के लिए निजी, सिंगल-टेनेंट एंडपॉइंट पाएँ [समर्पित डिप्लॉयमेंट](https://docs.roboflow.com/deployment/roboflow-cloud/dedicated-deployments)
* मॉडलों और लॉजिक को जोड़कर एक ऐप्लिकेशन बनाएँ [वर्कफ़्लो](https://docs.roboflow.com/workflows)
* जानें कि हर अनुरोध की लागत कितनी है [सर्वरलेस मूल्य निर्धारण पृष्ठ](https://docs.roboflow.com/deployment/roboflow-cloud/serverless-api/model-pricing)
