For the complete documentation index, see llms.txt. This page is also available as Markdown.

एक Model API Endpoint का उपयोग करें

Roboflow के cloud GPUs पर बिना hardware सेटअप किए पाँच मिनट में एक model चलाएँ।

यह Serverless Hosted API Roboflow के cloud में GPUs पर models और Workflows चलाता है। आप एक image भेजते हैं और results वापस पाते हैं। सेट अप करने के लिए कोई hardware नहीं है और चलाते रहने के लिए कोई server नहीं है।

यह guide आपको zero से लेकर five minutes में model चलाने तक ले जाता है। आप सिर्फ़ उनका नाम बताकर image में objects ढूँढेंगे, ready-made model से everyday objects detect करेंगे, और अपने own models चलाएँगे — सब एक ही Serverless API endpoint के against।

उनका नाम बताकर objects ढूँढें

model को कुछ शब्द दें जैसे "taxi", "blue bus", या "bush" और यह image में हर matching object की outline बनाता है। पहले कुछ भी सेट up या train करने की ज़रूरत नहीं है। यह चलता है SAM3.

1

अपनी API Key प्राप्त करें

एक Roboflow खाता बनाएं, अपनी key यहाँ पर ढूँढें Roboflow API settings page और इसे अपने shell में उपलब्ध कराएँ:

export ROBOFLOW_API_KEY="your-key-here"
2

निर्भरताएँ इंस्टॉल करें

supervision को लाता है cv2 और numpy:

pip install supervision
3

मॉडल चलाएँ

Send a POST request to /sam3/concept_segment model चलाने के लिए। sv.Detections.from_sam3 उन results को ऐसे form में बदलता है supervision जिसे draw किया जा सके:

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)

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

Outlines around taxis, a blue bus, and bushes from text prompts
text prompts से outlined किए गए objects

visual prompts, exemplar boxes, और RLE output सहित पूरे SAM3 API के लिए, देखें SAM3 documentation.

ready-made model से everyday objects detect करें

named ones की outline बनाने के बजाय common objects के चारों ओर boxes बनाने के लिए, कॉल करें POST /{project}/{version} model ID के साथ, बजाय इसके कि POST /sam3/concept_segment। यह example एक ready-made RF-DETR model का उपयोग करता है, जो vehicles, people, और pets जैसे common objects detect कर सकता है:

RF-DETR bounding boxes for cars, buses, people, and motorcycles
RF-DETR cars, buses, people, और motorcycles detect करता है

अपना खुद का या कोई और model चलाएँ

वही client.infer() या POST /{project}/{version} call उसके model_id:

  • Roboflow में आपने जो model प्रशिक्षित किया है. इसका model ID कॉपी करें (जो इस format में है {project}/{version}) को अपने project से Roboflow app

  • का एक public model Roboflow Universe

  • एक ready-made pretrained model को alias द्वारा, जैसे rfdetr-nano, rfdetr-seg-medium, या yolo26l-640 (सिर्फ़ inference SDK के लिए)

अगला कदम कहाँ जाएँ

आप cloud में एक model चला रहे हैं। यहाँ से आप कर सकते हैं:

  • अपने own hardware पर वही models चलाएँ। देखें Model को Local रूप से चलाएँ

  • bड़े models और स्थिर traffic के लिए एक private, single-tenant endpoint प्राप्त करें, साथ में Dedicated Deployments

  • models और logic को एक application में chain करें, साथ में Workflows

  • समझें कि हर request की लागत क्या है on the Serverless pricing page

अंतिम अपडेट

क्या यह उपयोगी था?