> 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/), पहले इसे install करें:

```
pip install inference-sdk
```

Serverless Hosted API को request भेजने के लिए, निम्न code का उपयोग करें:

<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). यह code आपके 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 पर train किया गया है। 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
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

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

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
