Spaces:
Sleeping
Sleeping
Commit
·
4dc5e51
1
Parent(s):
8dde699
up
Browse files- run_demo_openai.py +5 -3
run_demo_openai.py
CHANGED
@@ -62,7 +62,9 @@ def maybe_load_cached_pipeline(model_name):
|
|
62 |
if model is None:
|
63 |
downloaded_model_path = hf_hub_download(repo_id=model_name, filename=CHECKPOINT_FILENAME)
|
64 |
|
65 |
-
model = whisper.load_model(downloaded_model_path, device=device)
|
|
|
|
|
66 |
logger.info(f"`{model_name}` has been loaded on device `{device}`")
|
67 |
|
68 |
print_memory_info()
|
@@ -101,7 +103,7 @@ def transcribe(microphone, file_upload, with_timestamps, model_name=DEFAULT_MODE
|
|
101 |
# text = model.transcribe(file, **GEN_KWARGS)["text"]
|
102 |
text = infer(model, file, with_timestamps)
|
103 |
|
104 |
-
logger.info(f"Transcription by `{model_name}
|
105 |
|
106 |
return warn_output + text
|
107 |
|
@@ -124,7 +126,7 @@ def yt_transcribe(yt_url, with_timestamps, model_name=DEFAULT_MODEL_NAME):
|
|
124 |
# text = model.transcribe("audio.mp3", **GEN_KWARGS)["text"]
|
125 |
text = infer(model, "audio.mp3", with_timestamps)
|
126 |
|
127 |
-
logger.info(f'Transcription by `{model_name}` of "{yt_url}"
|
128 |
|
129 |
return html_embed_str, text
|
130 |
|
|
|
62 |
if model is None:
|
63 |
downloaded_model_path = hf_hub_download(repo_id=model_name, filename=CHECKPOINT_FILENAME)
|
64 |
|
65 |
+
# model = whisper.load_model(downloaded_model_path, device=device)
|
66 |
+
model = whisper.load_model(downloaded_model_path, device="cpu")
|
67 |
+
model = model.to(device)
|
68 |
logger.info(f"`{model_name}` has been loaded on device `{device}`")
|
69 |
|
70 |
print_memory_info()
|
|
|
103 |
# text = model.transcribe(file, **GEN_KWARGS)["text"]
|
104 |
text = infer(model, file, with_timestamps)
|
105 |
|
106 |
+
logger.info(f"Transcription by `{model_name}`:\n{text}\n")
|
107 |
|
108 |
return warn_output + text
|
109 |
|
|
|
126 |
# text = model.transcribe("audio.mp3", **GEN_KWARGS)["text"]
|
127 |
text = infer(model, "audio.mp3", with_timestamps)
|
128 |
|
129 |
+
logger.info(f'Transcription by `{model_name}` of "{yt_url}":\n{text}\n')
|
130 |
|
131 |
return html_embed_str, text
|
132 |
|