# Python SDK के साथ उपयोग करें

यदि आप Python में काम कर रहे हैं, तो Serverless API के साथ इंटरैक्ट करने का सबसे सुविधाजनक तरीका Inference Python SDK का उपयोग करना है।

का उपयोग करने के लिए [Inference SDK](https://inference.roboflow.com/inference_helpers/inference_sdk/)को पहले इंस्टॉल करें:

```
pip install inference-sdk
```

Serverless Hosted API को अनुरोध भेजने के लिए, निम्नलिखित कोड का उपयोग करें:

<pre class="language-python"><code class="lang-python"><strong>from inference_sdk import InferenceHTTPClient
</strong>
CLIENT = InferenceHTTPClient(
    api_url="https://serverless.roboflow.com",
    api_key="API_KEY"
)

result = CLIENT.infer("image.jpg", model_id="model-id/1")
print(result)
</code></pre>

ऊपर, अपना [model ID](https://docs.roboflow.com/developer/authentication/workspace-and-project-ids) और [API key](https://docs.roboflow.com/developer/authentication/find-your-roboflow-api-key)निर्दिष्ट करें। यह कोड आपके model को चलाएगा और परिणाम लौटाएगा।

#### Roboflow Instant Model

Serverless API Roboflow को चलाने का भी समर्थन करता है [Instant Model](/roboflow/roboflow-hi/train/roboflow-instant.md)। आप Instant Model को किसी अन्य model की तरह चला सकते हैं, बस ध्यान रखें कि confidence threshold Instant Models के लिए संवेदनशील हो सकता है।

{% hint style="info" %}
एक optimal confidence इस बात पर निर्भर करता है कि model को कितनी images पर trained किया गया है। Optimal confidence thresholds आमतौर पर 0.85 से 0.99 के बीच होते हैं।
{% endhint %}

```python
configuration = InferenceConfiguration(
    confidence_threshold=0.95
)
CLIENT.configure(configuration)

result = CLIENT.infer("image.jpg", model_id="roboflow-instant-model-id/1")
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.roboflow.com/roboflow/roboflow-hi/deploy/serverless-hosted-api-v2/use-with-python-sdk.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
