Commit ·
7bcdc7e
1
Parent(s): 5863cc6
Set dummy value for second output
Browse files
app.py
CHANGED
|
@@ -34,6 +34,8 @@ def chunks_to_srt(chunks):
|
|
| 34 |
|
| 35 |
def transcribe(inputs, task, return_timestamps, language):
|
| 36 |
|
|
|
|
|
|
|
| 37 |
print(f"Input type: {type(inputs)}")
|
| 38 |
try:
|
| 39 |
if inputs is None:
|
|
@@ -45,15 +47,15 @@ def transcribe(inputs, task, return_timestamps, language):
|
|
| 45 |
result = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task, "language": f"<|{language_code}|>"}, return_timestamps=return_timestamps)
|
| 46 |
|
| 47 |
if return_timestamps:
|
| 48 |
-
return chunks_to_srt(result['chunks'])
|
| 49 |
else:
|
| 50 |
-
return result['text']
|
| 51 |
|
| 52 |
except Exception as e:
|
| 53 |
|
| 54 |
print(f"Error - {e}")
|
| 55 |
|
| 56 |
-
return e
|
| 57 |
|
| 58 |
|
| 59 |
# def convert_audio(audio_input):
|
|
|
|
| 34 |
|
| 35 |
def transcribe(inputs, task, return_timestamps, language):
|
| 36 |
|
| 37 |
+
placeholder = 'Placeholder'
|
| 38 |
+
|
| 39 |
print(f"Input type: {type(inputs)}")
|
| 40 |
try:
|
| 41 |
if inputs is None:
|
|
|
|
| 47 |
result = pipe(inputs, batch_size=BATCH_SIZE, generate_kwargs={"task": task, "language": f"<|{language_code}|>"}, return_timestamps=return_timestamps)
|
| 48 |
|
| 49 |
if return_timestamps:
|
| 50 |
+
return chunks_to_srt(result['chunks']), placeholder
|
| 51 |
else:
|
| 52 |
+
return result['text'], placeholder
|
| 53 |
|
| 54 |
except Exception as e:
|
| 55 |
|
| 56 |
print(f"Error - {e}")
|
| 57 |
|
| 58 |
+
return e, placeholder
|
| 59 |
|
| 60 |
|
| 61 |
# def convert_audio(audio_input):
|