> 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-hi/deploy/serverless-hosted-api-v2/use-with-python-sdk.md).

# 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). यह कोड आपका मॉडल चलाएगा और परिणाम लौटाएगा।

#### Roboflow Instant Model

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

{% hint style="info" %}
एक optimal confidence इस बात पर निर्भर करता है कि मॉडल को कितनी images पर प्रशिक्षित किया गया है। 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")
```
