# Difference between serve run and serve deploy commands

**URL:** <https://discuss.ray.io/t/difference-between-serve-run-and-serve-deploy-commands/13511>\
**Category:** Ray Clusters\
**Created:** [January 23, 2024, 4:33pm UTC](https://discuss.ray.io/t/difference-between-serve-run-and-serve-deploy-commands/13511 "2024-01-23T16:33:15Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![ankitp](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ankitp](https://discuss.ray.io/u/ankitp)\
**Post date:** [January 23, 2024, 4:33pm UTC](https://discuss.ray.io/t/difference-between-serve-run-and-serve-deploy-commands/13511/1 "2024-01-23T16:33:16Z")

</div>

Hi

```auto
# File name: serve_quickstart.py
from starlette.requests import Request
import os
import ray
from ray import serve

# from transformers import pipeline

# from ray_app.trt.trt_model import TrtModel
from ray_app.utils.utils import preprocess, nms, xywh2xyxy
# from ray_app.trt.trt_model import TrtModel

# import json

# import numpy as np
# import urllib.request

from fastapi import FastAPI, File, Form, HTTPException
app = FastAPI()

@serve.deployment(num_replicas=1, ray_actor_options={"num_cpus": 0.2, "num_gpus": 0.2})
@serve.ingress(app)
class Faceblur:
    def __init__ (self):
        MODEL_PATH = "/app/weights/yolov7-face.trt"
        os.environ["CUDA_VISIBLE_DEVICES"] = "0"
        print(f'# ray.get_gpu_ids(): {ray.get_gpu_ids()}')
        print(f'# os.environ["CUDA_VISIBLE_DEVICES"]: {os.environ["CUDA_VISIBLE_DEVICES"]}')

    @app.get("/")
    def home(self):
        return "Welcome!"
    
faceblur_app = Faceblur.bind()

```

I am using this as entrypoint for my ray\_app module. When I am running it using serve run command its able to run properly but when I am trying to use the same piece of code using serve deploy I am getting error that CUDA not found. I want to understand what’s wrong with my approach.  
Also these print statements giving me empty array  
print(f’# ray.get\_gpu\_ids(): {ray.get\_gpu\_ids()}‘)  
print(f’# os.environ[“CUDA\_VISIBLE\_DEVICES”]: {os.environ[“CUDA\_VISIBLE\_DEVICES”]}')
