Spaces:
Running
on
Zero
Running
on
Zero
Update app.py
Browse files
app.py
CHANGED
@@ -15,18 +15,19 @@ share = (os.environ.get("SHARE", "False")[0].lower() in "ty1") or None
|
|
15 |
auth_token = os.environ.get("AUTH_TOKEN") or True
|
16 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
17 |
print(f"Using device: {device}")
|
18 |
-
pipe = pipeline(
|
19 |
-
task="automatic-speech-recognition",
|
20 |
-
model=MODEL_NAME,
|
21 |
-
chunk_length_s=30,
|
22 |
-
token=auth_token,
|
23 |
-
)
|
24 |
-
|
25 |
-
pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language=lang, task="transcribe")
|
26 |
|
27 |
@spaces.GPU(duration=120)
|
28 |
def transcribe(file): #microphone, file_upload):
|
29 |
-
pipe
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
30 |
warn_output = ""
|
31 |
# if (microphone is not None) and (file_upload is not None):
|
32 |
# warn_output = (
|
|
|
15 |
auth_token = os.environ.get("AUTH_TOKEN") or True
|
16 |
device = torch.device("cuda:0" if torch.cuda.is_available() else "cpu")
|
17 |
print(f"Using device: {device}")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
18 |
|
19 |
@spaces.GPU(duration=120)
|
20 |
def transcribe(file): #microphone, file_upload):
|
21 |
+
pipe = pipeline(
|
22 |
+
task="automatic-speech-recognition",
|
23 |
+
model=MODEL_NAME,
|
24 |
+
chunk_length_s=30,
|
25 |
+
device=device,
|
26 |
+
token=auth_token,
|
27 |
+
)
|
28 |
+
|
29 |
+
pipe.model.config.forced_decoder_ids = pipe.tokenizer.get_decoder_prompt_ids(language=lang, task="transcribe")
|
30 |
+
#pipe.to(device)
|
31 |
warn_output = ""
|
32 |
# if (microphone is not None) and (file_upload is not None):
|
33 |
# warn_output = (
|