Spaces:
Runtime error
Runtime error
BjarneBepaData
commited on
Commit
•
4f17583
1
Parent(s):
d6378a2
Removing the temporary directory
Browse files- app/main.py +2 -4
app/main.py
CHANGED
@@ -1,10 +1,8 @@
|
|
1 |
from fastapi import FastAPI
|
2 |
import torch
|
3 |
-
import tempdir
|
4 |
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
|
5 |
|
6 |
app = FastAPI()
|
7 |
-
temp_dir = tempdir.TemporaryDirectory()
|
8 |
|
9 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
10 |
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
@@ -13,11 +11,11 @@ model_id = "openai/whisper-large-v3"
|
|
13 |
|
14 |
model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
15 |
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True,
|
16 |
-
cache_dir=
|
17 |
)
|
18 |
model.to(device)
|
19 |
|
20 |
-
processor = AutoProcessor.from_pretrained(model_id, cache_dir=
|
21 |
|
22 |
pipe = pipeline(
|
23 |
"automatic-speech-recognition",
|
|
|
1 |
from fastapi import FastAPI
|
2 |
import torch
|
|
|
3 |
from transformers import AutoModelForSpeechSeq2Seq, AutoProcessor, pipeline
|
4 |
|
5 |
app = FastAPI()
|
|
|
6 |
|
7 |
device = "cuda" if torch.cuda.is_available() else "cpu"
|
8 |
torch_dtype = torch.float16 if torch.cuda.is_available() else torch.float32
|
|
|
11 |
|
12 |
model = AutoModelForSpeechSeq2Seq.from_pretrained(
|
13 |
model_id, torch_dtype=torch_dtype, low_cpu_mem_usage=True, use_safetensors=True,
|
14 |
+
cache_dir="./"
|
15 |
)
|
16 |
model.to(device)
|
17 |
|
18 |
+
processor = AutoProcessor.from_pretrained(model_id, cache_dir="./")
|
19 |
|
20 |
pipe = pipeline(
|
21 |
"automatic-speech-recognition",
|