Upload folder using huggingface_hub
Browse files- MANIFEST.sha256 +1 -1
- RELEASE-MANIFEST.json +1 -1
- gradio_app.py +24 -28
MANIFEST.sha256
CHANGED
|
@@ -71,7 +71,7 @@ c9ceaeaa4a054d59396b1c33394c3db9fb7fc6577edd72cbb1016a7ea83af9a9 glossary_parse
|
|
| 71 |
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 glossary_parser/vaudois_lexicon.pl
|
| 72 |
98becf1f491b917c6b3cb902f291697fa31b3dd493913b4bf8e97797f0610b1b glossary_parser/vaudois_parsed.csv
|
| 73 |
67f3f68c6f88a9676648599129882ea1cf0cac49a16dbbece6cc473b2f6a08fb glossary_parser/vaudois_prolog_parsed.csv
|
| 74 |
-
|
| 75 |
a7e8f5642752b12128382bf9c27f227329a9a4a67e58f3112704ff818e8f1af2 piper_multi_model.py
|
| 76 |
1b116781e56d301686545461db76490844630d5411d6f43f55a7c15cb9c17bb5 piper_tts.py
|
| 77 |
cf1b4ef0829aa87cfd87aff09fcd5720a48c3001b7910a46ed05d768a4201fda requirements.txt
|
|
|
|
| 71 |
e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855 glossary_parser/vaudois_lexicon.pl
|
| 72 |
98becf1f491b917c6b3cb902f291697fa31b3dd493913b4bf8e97797f0610b1b glossary_parser/vaudois_parsed.csv
|
| 73 |
67f3f68c6f88a9676648599129882ea1cf0cac49a16dbbece6cc473b2f6a08fb glossary_parser/vaudois_prolog_parsed.csv
|
| 74 |
+
47c8f5ce556f0a07e771d1dc707fa8e4d956479c2f6ae547a842be7d56c976f8 gradio_app.py
|
| 75 |
a7e8f5642752b12128382bf9c27f227329a9a4a67e58f3112704ff818e8f1af2 piper_multi_model.py
|
| 76 |
1b116781e56d301686545461db76490844630d5411d6f43f55a7c15cb9c17bb5 piper_tts.py
|
| 77 |
cf1b4ef0829aa87cfd87aff09fcd5720a48c3001b7910a46ed05d768a4201fda requirements.txt
|
RELEASE-MANIFEST.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
| 4 |
"archive_label": "TraductAL-v1.1.0",
|
| 5 |
"generated": "2026-10-02",
|
| 6 |
"file_count": 101,
|
| 7 |
-
"uncompressed_bytes":
|
| 8 |
"translation_engine": {
|
| 9 |
"model": "swiss-ai/Apertus-8B-Instruct-2509",
|
| 10 |
"license": "Apache-2.0",
|
|
|
|
| 4 |
"archive_label": "TraductAL-v1.1.0",
|
| 5 |
"generated": "2026-10-02",
|
| 6 |
"file_count": 101,
|
| 7 |
+
"uncompressed_bytes": 4450819,
|
| 8 |
"translation_engine": {
|
| 9 |
"model": "swiss-ai/Apertus-8B-Instruct-2509",
|
| 10 |
"license": "Apache-2.0",
|
gradio_app.py
CHANGED
|
@@ -724,45 +724,37 @@ def speak_translation(translation, tgt_lang_name, voice_selection="Default"):
|
|
| 724 |
|
| 725 |
|
| 726 |
@gpu(duration=ZERO_GPU_MAX_DURATION)
|
| 727 |
-
def audio_to_audio_pipeline(audio_file, src_lang_name, tgt_lang_name
|
| 728 |
-
"""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 729 |
if not tts_enabled:
|
| 730 |
-
return "", "",
|
| 731 |
|
| 732 |
if audio_file is None:
|
| 733 |
-
return "", "",
|
| 734 |
|
| 735 |
-
# Step 1: Transcribe
|
| 736 |
transcription = _transcribe_impl(audio_file, src_lang_name)
|
| 737 |
|
| 738 |
if transcription.startswith("β") or transcription.startswith("β οΈ"):
|
| 739 |
-
return transcription, "",
|
| 740 |
|
| 741 |
-
# Step 2: Translate
|
| 742 |
src_code = STT_LANGUAGES.get(src_lang_name)
|
| 743 |
tgt_code = ALL_LANGUAGES.get(tgt_lang_name)
|
| 744 |
-
result = translator.translate(transcription, src_code, tgt_code)
|
| 745 |
-
|
| 746 |
-
if "error" in result:
|
| 747 |
-
return transcription, f"β Translation failed: {result['error']}", None, ""
|
| 748 |
-
|
| 749 |
-
translation = result.get("translation", "")
|
| 750 |
|
| 751 |
-
# Step 3: Text-to-Speech (use default engine - Piper TTS with fallback)
|
| 752 |
try:
|
| 753 |
-
|
| 754 |
-
speaker = None if voice_selection == "Auto (Default)" or voice_selection == "Default" else voice_selection
|
| 755 |
-
|
| 756 |
-
audio_path, sample_rate, engine_used = synthesize_speech(
|
| 757 |
-
translation,
|
| 758 |
-
tgt_lang_name,
|
| 759 |
-
speaker=speaker,
|
| 760 |
-
)
|
| 761 |
-
voice_info = f"\nποΈ Voice: {speaker}" if speaker else ""
|
| 762 |
-
details = f"β
Complete pipeline successful!\nπ€ TTS: {engine_used}{voice_info}\nπ Audio sample rate: {sample_rate}Hz"
|
| 763 |
-
return transcription, translation, audio_path, details
|
| 764 |
except Exception as e:
|
| 765 |
-
return transcription,
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 766 |
|
| 767 |
|
| 768 |
# Create Gradio interface with professional theme
|
|
@@ -1265,8 +1257,12 @@ with gr.Blocks(title="TraductAL - Multilingual, multimodal translation system")
|
|
| 1265 |
|
| 1266 |
pipeline_btn.click(
|
| 1267 |
fn=audio_to_audio_pipeline,
|
| 1268 |
-
inputs=[pipeline_audio_input, pipeline_src_lang, pipeline_tgt_lang
|
| 1269 |
-
outputs=[pipeline_transcription, pipeline_translation,
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1270 |
)
|
| 1271 |
|
| 1272 |
# Tab 8: About & Info
|
|
|
|
| 724 |
|
| 725 |
|
| 726 |
@gpu(duration=ZERO_GPU_MAX_DURATION)
|
| 727 |
+
def audio_to_audio_pipeline(audio_file, src_lang_name, tgt_lang_name):
|
| 728 |
+
"""Audio (any language) -> Transcription -> Translation.
|
| 729 |
+
|
| 730 |
+
Runs inside the ZeroGPU lease. Speech synthesis is delegated to
|
| 731 |
+
speak_translation(), which is undecorated: TTS is CPU-only, so doing it
|
| 732 |
+
here would spend the lease's duration budget on non-GPU work.
|
| 733 |
+
"""
|
| 734 |
if not tts_enabled:
|
| 735 |
+
return "", "", "β TTS engine not available"
|
| 736 |
|
| 737 |
if audio_file is None:
|
| 738 |
+
return "", "", "β οΈ Please upload an audio file"
|
| 739 |
|
|
|
|
| 740 |
transcription = _transcribe_impl(audio_file, src_lang_name)
|
| 741 |
|
| 742 |
if transcription.startswith("β") or transcription.startswith("β οΈ"):
|
| 743 |
+
return transcription, "", str(transcription)
|
| 744 |
|
|
|
|
| 745 |
src_code = STT_LANGUAGES.get(src_lang_name)
|
| 746 |
tgt_code = ALL_LANGUAGES.get(tgt_lang_name)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 747 |
|
|
|
|
| 748 |
try:
|
| 749 |
+
result = translator.translate(transcription, src_code, tgt_code)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 750 |
except Exception as e:
|
| 751 |
+
return transcription, "", f"β Translation failed: {type(e).__name__}: {e}"
|
| 752 |
+
|
| 753 |
+
if "error" in result:
|
| 754 |
+
return transcription, "", f"β Translation failed: {result['error']}"
|
| 755 |
+
|
| 756 |
+
return (transcription, result.get("translation", ""),
|
| 757 |
+
"β
Transcription and translation complete. Generating speech...")
|
| 758 |
|
| 759 |
|
| 760 |
# Create Gradio interface with professional theme
|
|
|
|
| 1257 |
|
| 1258 |
pipeline_btn.click(
|
| 1259 |
fn=audio_to_audio_pipeline,
|
| 1260 |
+
inputs=[pipeline_audio_input, pipeline_src_lang, pipeline_tgt_lang],
|
| 1261 |
+
outputs=[pipeline_transcription, pipeline_translation, pipeline_status]
|
| 1262 |
+
).then(
|
| 1263 |
+
fn=speak_translation,
|
| 1264 |
+
inputs=[pipeline_translation, pipeline_tgt_lang, pipeline_voice],
|
| 1265 |
+
outputs=[pipeline_audio_output, pipeline_status]
|
| 1266 |
)
|
| 1267 |
|
| 1268 |
# Tab 8: About & Info
|