added timstamp option
#5
by
new4u
- opened
app.py
CHANGED
|
@@ -13,6 +13,7 @@ pipe = pipeline(
|
|
| 13 |
model=MODEL_NAME,
|
| 14 |
chunk_length_s=30,
|
| 15 |
device=device,
|
|
|
|
| 16 |
)
|
| 17 |
|
| 18 |
|
|
@@ -35,8 +36,7 @@ def transcribe(microphone, file_upload, task):
|
|
| 35 |
file = microphone if microphone is not None else file_upload
|
| 36 |
|
| 37 |
pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id if task=="transcribe" else translate_token_id]]
|
| 38 |
-
|
| 39 |
-
text = pipe(file)["text"]
|
| 40 |
|
| 41 |
return warn_output + text
|
| 42 |
|
|
|
|
| 13 |
model=MODEL_NAME,
|
| 14 |
chunk_length_s=30,
|
| 15 |
device=device,
|
| 16 |
+
# return_timestamps=True
|
| 17 |
)
|
| 18 |
|
| 19 |
|
|
|
|
| 36 |
file = microphone if microphone is not None else file_upload
|
| 37 |
|
| 38 |
pipe.model.config.forced_decoder_ids = [[2, transcribe_token_id if task=="transcribe" else translate_token_id]]
|
| 39 |
+
text = pipe(file,return_timestamps=True)["text"]
|
|
|
|
| 40 |
|
| 41 |
return warn_output + text
|
| 42 |
|