Spaces:
Runtime error
Runtime error
Upload app.py
Browse files
app.py
CHANGED
@@ -1,11 +1,11 @@
|
|
1 |
# -*- coding: utf-8 -*-
|
2 |
-
"""Built_Speech-to-Speech_Translation.ipynb
|
3 |
|
4 |
-
Automatically generated by Colaboratory.
|
|
|
|
|
|
|
5 |
|
6 |
-
Original file is located at
|
7 |
-
https://colab.research.google.com/drive/1AHToRlVpGAy3jQdbTm14tDdTyRPc-oG3
|
8 |
-
"""
|
9 |
"""Speech Translation to Text Part"""
|
10 |
|
11 |
from huggingface_hub import login
|
@@ -21,10 +21,6 @@ pipe = pipeline(
|
|
21 |
|
22 |
from datasets import load_dataset
|
23 |
dataset = load_dataset("facebook/voxpopuli", "nl", split="validation", streaming=True)
|
24 |
-
sample = next(iter(dataset))
|
25 |
-
|
26 |
-
from IPython.display import Audio
|
27 |
-
Audio(sample["audio"]["array"], rate=sample["audio"]["sampling_rate"])
|
28 |
|
29 |
def translate(audio):
|
30 |
outputs = pipe(audio, max_new_tokens=256, generate_kwargs={"task": "transcribe", "language": "nl"})
|
@@ -67,7 +63,6 @@ sampling_rate, synthesized_speech = speech_to_speech_translation(sample["audio"]
|
|
67 |
Audio(synthesized_speech, rate=sampling_rate)
|
68 |
|
69 |
import gradio as gr
|
70 |
-
from gradio.mix import Series
|
71 |
|
72 |
demo = gr.Blocks()
|
73 |
description = "Speech-to-Speech Translation En->Nl"
|
|
|
1 |
# -*- coding: utf-8 -*-
|
2 |
+
"""Built_Speech-to-Speech_Translation.ipynb"""
|
3 |
|
4 |
+
# Automatically generated by Colaboratory.
|
5 |
+
|
6 |
+
# Original file is located at
|
7 |
+
# https://colab.research.google.com/drive/1AHToRlVpGAy3jQdbTm14tDdTyRPc-oG3
|
8 |
|
|
|
|
|
|
|
9 |
"""Speech Translation to Text Part"""
|
10 |
|
11 |
from huggingface_hub import login
|
|
|
21 |
|
22 |
from datasets import load_dataset
|
23 |
dataset = load_dataset("facebook/voxpopuli", "nl", split="validation", streaming=True)
|
|
|
|
|
|
|
|
|
24 |
|
25 |
def translate(audio):
|
26 |
outputs = pipe(audio, max_new_tokens=256, generate_kwargs={"task": "transcribe", "language": "nl"})
|
|
|
63 |
Audio(synthesized_speech, rate=sampling_rate)
|
64 |
|
65 |
import gradio as gr
|
|
|
66 |
|
67 |
demo = gr.Blocks()
|
68 |
description = "Speech-to-Speech Translation En->Nl"
|