Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
|
@@ -299,7 +299,8 @@ def infer_batch(ref_audio, ref_text, gen_text_batches, exp_name, remove_silence,
|
|
| 299 |
return (target_sample_rate, final_wave), spectrogram_path
|
| 300 |
|
| 301 |
@gpu_decorator
|
| 302 |
-
def infer(ref_audio_orig, ref_text, gen_text, exp_name, remove_silence, cross_fade_duration=0.15
|
|
|
|
| 303 |
|
| 304 |
print(gen_text)
|
| 305 |
|
|
@@ -324,11 +325,13 @@ def infer(ref_audio_orig, ref_text, gen_text, exp_name, remove_silence, cross_fa
|
|
| 324 |
|
| 325 |
if not ref_text.strip():
|
| 326 |
gr.Info("No reference text provided, transcribing reference audio...")
|
|
|
|
| 327 |
ref_text = pipe(
|
| 328 |
ref_audio,
|
| 329 |
chunk_length_s=30,
|
| 330 |
batch_size=128,
|
| 331 |
-
generate_kwargs={"task": "transcribe"
|
|
|
|
| 332 |
return_timestamps=False,
|
| 333 |
)["text"].strip()
|
| 334 |
gr.Info("Finished transcription")
|
|
|
|
| 299 |
return (target_sample_rate, final_wave), spectrogram_path
|
| 300 |
|
| 301 |
@gpu_decorator
|
| 302 |
+
def infer(ref_audio_orig, ref_text, gen_text, exp_name, remove_silence, cross_fade_duration=0.15 ,language_code = "pl" # Set the desired language code dynamically
|
| 303 |
+
):
|
| 304 |
|
| 305 |
print(gen_text)
|
| 306 |
|
|
|
|
| 325 |
|
| 326 |
if not ref_text.strip():
|
| 327 |
gr.Info("No reference text provided, transcribing reference audio...")
|
| 328 |
+
|
| 329 |
ref_text = pipe(
|
| 330 |
ref_audio,
|
| 331 |
chunk_length_s=30,
|
| 332 |
batch_size=128,
|
| 333 |
+
generate_kwargs={"task": "transcribe","language": language_code # Use the variable here
|
| 334 |
+
},
|
| 335 |
return_timestamps=False,
|
| 336 |
)["text"].strip()
|
| 337 |
gr.Info("Finished transcription")
|