Update app.py
Browse files
app.py
CHANGED
@@ -9,8 +9,7 @@ import time
|
|
9 |
app = FastAPI()
|
10 |
|
11 |
# Load the Whisper model once during startup
|
12 |
-
|
13 |
-
device = -1
|
14 |
asr_pipeline = pipeline(model="openai/whisper-tiny", device=device) # Initialize Whisper model
|
15 |
|
16 |
# Basic GET endpoint
|
|
|
9 |
app = FastAPI()
|
10 |
|
11 |
# Load the Whisper model once during startup
|
12 |
+
device = 0 if torch.cuda.is_available() else -1 # Use GPU if available, otherwise CPU
|
|
|
13 |
asr_pipeline = pipeline(model="openai/whisper-tiny", device=device) # Initialize Whisper model
|
14 |
|
15 |
# Basic GET endpoint
|