> ## Documentation Index
> Fetch the complete documentation index at: https://wb-21fd5541-docs-hivemind-launch.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

# Serve

> Weave の op とモデルを API エンドポイントとして公開し、予測のサービングや本番環境での推論を実行します。

任意の Weave Model を指す Weave ref があれば、次を実行できます。

```
weave serve <ref>
```

そのモデル用のFastAPIサーバーを起動します。[http://0.0.0.0:9996/docs](http://0.0.0.0:9996/docs) にアクセスすると、モデルをインタラクティブにクエリできます。

<div id="install-fastapi">
  ## FastAPIのインストール
</div>

```bash theme={null}
pip install fastapi uvicorn
```

<div id="serve-model">
  ## モデルをServeする
</div>

ターミナルで次を実行します。

```bash theme={null}
weave serve <your model ref>
```

モデルのページにアクセスして UI からコピーすると、モデル ref を取得できます。次のようになります。
`weave://your_entity/project-name/YourModel:<hash>`

これを使用するには、Swagger UI のリンクにアクセスし、predict エンドポイントをクリックしてから、"Try it out!" をクリックします.
