> 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 एंडपॉइंट का उपयोग करें

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

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

## उन्हें नाम देकर वस्तुएँ ढूँढें

मॉडल को कुछ शब्द दें जैसे `"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 खाता बनाएँ, अपनी key यहाँ खोजें [Roboflow API settings page](https://app.roboflow.com/settings/api) और इसे अपने shell में उपलब्ध कराएँ:

```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) जिसे draw किया जा सके:

```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 खाता बनाएँ, अपनी key यहाँ खोजें [Roboflow API settings page](https://app.roboflow.com/settings/api) और इसे अपने shell में उपलब्ध कराएँ:

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

{% endstep %}

{% step %}

### डिपेंडेंसीज़ इंस्टॉल करें

ये दो पैकेज मॉडल को कॉल करते हैं और उसके परिणामों को draw करते हैं:

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

{% endstep %}

{% step %}

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

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

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

प्रतिक्रिया में हर prompt के लिए मिली रूपरेखाएँ सूचीबद्ध होती हैं, और हर एक के लिए एक confidence score होता है। `sv.Detections.from_sam3` यह सब आपके लिए पढ़ लेता है।

<figure><img src="/files/adaf968cce0f4a0a7643e1a962c760b119b35eb3" alt="Outlines around taxis, a blue bus, and bushes from text prompts"><figcaption><p>टेक्स्ट prompts से रूपरेखाबद्ध वस्तुएँ</p></figcaption></figure>

विज़ुअल prompts, exemplar boxes, और RLE output सहित पूरे SAM3 API के लिए, देखें [SAM3 documentation](https://docs.roboflow.com/models/supported-models/sam3).

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

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

```python
result = requests.post(
    "https://serverless.roboflow.com/coco/40",  # coco/40 is the rfdetr-medium alias
    params={"api_key": os.environ["ROBOFLOW_API_KEY"]},
    data=image_b64,  # raw base64 in the body, not 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()` के साथ, बजाय इसके कि `client.sam3_concept_segment()`. यह उदाहरण एक तैयार-निर्मित [RF-DETR](https://docs.roboflow.com/models/supported-models/rf-detr) मॉडल का उपयोग करता है, जो वाहनों, लोगों, और पालतू जानवरों जैसी सामान्य वस्तुओं का पता लगा सकता है:

```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/5a89af65ead75a4dd7acbb74b098b2917d95d79c" alt="RF-DETR bounding boxes for cars, buses, people, and motorcycles"><figcaption><p>RF-DETR कारों, बसों, लोगों, और मोटरसाइकिलों का पता लगाता है</p></figcaption></figure>

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

वही `client.infer()` या `POST /{project}/{version}` call उसके द्वारा किसी भी मॉडल को चलाता है `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 के लिए)

## आगे कहाँ जाएँ

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

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