import{s as Q,o as W,n as Z}from"../chunks/scheduler.f7e1785c.js";import{S as ee,i as te,g as c,s as u,r as U,A as ne,h,f as t,c as p,j as N,u as A,x as g,k as R,y as oe,a as o,v as j,d as D,t as G,w as z,m as F,n as O}from"../chunks/index.9f8f0838.js";import{T as ae}from"../chunks/Tip.4575d9cf.js";import{H as se,E as ie}from"../chunks/getInferenceSnippets.ad8e59bc.js";function re(S){let i,r,b="requirements.txt",d,s,T="transformers",l,f,x="<code>git+https://github.com/hollance/transformers.git@6900e8ba6532162a8613d2270ec2286c3f58f57b</code>";return{c(){i=F(`In our experience experimenting with the Dutch language, using an MMS TTS checkpoint results in better performance than a
    fine-tuned SpeechT5 one, but you might find that your fine-tuned TTS checkpoint is preferable in your language.
    If you decide to use an MMS TTS checkpoint, you will need to update the `),r=c("a"),r.textContent=b,d=F(`
    file of your demo to install `),s=c("code"),s.textContent=T,l=F(` from the PR branch:
    `),f=c("p"),f.innerHTML=x,this.h()},l(a){i=O(a,`In our experience experimenting with the Dutch language, using an MMS TTS checkpoint results in better performance than a
    fine-tuned SpeechT5 one, but you might find that your fine-tuned TTS checkpoint is preferable in your language.
    If you decide to use an MMS TTS checkpoint, you will need to update the `),r=h(a,"A",{href:!0,"data-svelte-h":!0}),g(r)!=="svelte-l0vtp8"&&(r.textContent=b),d=O(a,`
    file of your demo to install `),s=h(a,"CODE",{"data-svelte-h":!0}),g(s)!=="svelte-olzpwg"&&(s.textContent=T),l=O(a,` from the PR branch:
    `),f=h(a,"P",{"data-svelte-h":!0}),g(f)!=="svelte-1oo2kle"&&(f.innerHTML=x),this.h()},h(){R(r,"href","https://huggingface.co/spaces/course-demos/speech-to-speech-translation/blob/a03175878f522df7445290d5508bfb5c5178f787/requirements.txt#L2")},m(a,m){o(a,i,m),o(a,r,m),o(a,d,m),o(a,s,m),o(a,l,m),o(a,f,m)},p:Z,d(a){a&&(t(i),t(r),t(d),t(s),t(l),t(f))}}}function le(S){let i,r,b,d,s,T,l,f=`In this Unit, we consolidated the material covered in the previous six units of the course to build three integrated
audio applications. As you’ve experienced, building more involved audio tools is fully within reach by using the
foundational skills you’ve acquired in this course.`,x,a,m=`The hands-on exercise takes one of the applications covered in this Unit, and extends it with a few multilingual
tweaks 🌍 Your objective is to take the <a href="https://huggingface.co/spaces/course-demos/speech-to-speech-translation" rel="nofollow">cascaded speech-to-speech translation Gradio demo</a>
from the first section in this Unit, and update it to translate to any <strong>non-English</strong> language. That is to say, the
demo should take speech in language X, and translate it to speech in language Y, where the target language Y is not
English. You should start by <a href="https://huggingface.co/spaces/course-demos/speech-to-speech-translation?duplicate=true" rel="nofollow">duplicating</a>
the template under your Hugging Face namespace. There’s no requirement to use a GPU accelerator device - the free CPU
tier works just fine 🤗 However, you should ensure that the visibility of your demo is set to <strong>public</strong>. This is required
such that your demo is accessible to us and can thus be checked for correctness.`,H,v,X=`Tips for updating the speech translation function to perform multilingual speech translation are provided in the
section on <a href="speech-to-speech">speech-to-speech translation</a>. By following these instructions, you should be able
to update the demo to translate from speech in language X to text in language Y, which is half of the task!`,C,_,B=`To synthesise from text in language Y to speech in language Y, where Y is a multilingual language, you will need
to use a multilingual TTS checkpoint. For this, you can either use the SpeechT5 TTS checkpoint that you fine-tuned
in the previous hands-on exercise, or a pre-trained multilingual TTS checkpoint. There are two options for pre-trained
checkpoints, either the checkpoint <a href="https://huggingface.co/sanchit-gandhi/speecht5_tts_vox_nl" rel="nofollow">sanchit-gandhi/speecht5_tts_vox_nl</a>,
which is a SpeechT5 checkpoint fine-tuned on the Dutch split of the <a href="https://huggingface.co/datasets/facebook/voxpopuli" rel="nofollow">VoxPopuli</a>
dataset, or an MMS TTS checkpoint (see section on <a href="../chapter6/pre-trained_models">pretrained models for TTS</a>).`,P,y,L,w,K=`Your demo should take as input an audio file, and return as output another audio file, matching the signature of the
<a href="https://huggingface.co/spaces/course-demos/speech-to-speech-translation/blob/3946ba6705a6632a63de8672ac52a482ab74b3fc/app.py#L35" rel="nofollow"><code>speech_to_speech_translation</code></a>
function in the template demo. Therefore, we recommend that you leave the main function <code>speech_to_speech_translation</code>
as is, and only update the <a href="https://huggingface.co/spaces/course-demos/speech-to-speech-translation/blob/a03175878f522df7445290d5508bfb5c5178f787/app.py#L24" rel="nofollow"><code>translate</code></a>
and <a href="https://huggingface.co/spaces/course-demos/speech-to-speech-translation/blob/a03175878f522df7445290d5508bfb5c5178f787/app.py#L29" rel="nofollow"><code>synthesise</code></a>
functions as required.`,E,k,V=`Once you have built your demo as a Gradio demo on the Hugging Face Hub, you can submit it for assessment. Head to the
Space <a href="https://huggingface.co/spaces/huggingface-course/audio-course-u7-assessment" rel="nofollow">audio-course-u7-assessment</a> and
provide the repository id of your demo when prompted. This Space will check that your demo has been built correctly by
sending a sample audio file to your demo and checking that the returned audio file is indeed non-English. If your demo
works correctly, you’ll get a green tick next to your name on the overall <a href="https://huggingface.co/spaces/MariaK/Check-my-progress-Audio-Course" rel="nofollow">progress space</a> ✅`,Y,$,q,M,I;return s=new se({props:{title:"Hands-on exercise",local:"hands-on-exercise",headingTag:"h1"}}),y=new ae({props:{$$slots:{default:[re]},$$scope:{ctx:S}}}),$=new ie({props:{source:"https://github.com/huggingface/audio-transformers-course/blob/main/chapters/en/chapter7/hands_on.mdx"}}),{c(){i=c("meta"),r=u(),b=c("p"),d=u(),U(s.$$.fragment),T=u(),l=c("p"),l.textContent=f,x=u(),a=c("p"),a.innerHTML=m,H=u(),v=c("p"),v.innerHTML=X,C=u(),_=c("p"),_.innerHTML=B,P=u(),U(y.$$.fragment),L=u(),w=c("p"),w.innerHTML=K,E=u(),k=c("p"),k.innerHTML=V,Y=u(),U($.$$.fragment),q=u(),M=c("p"),this.h()},l(e){const n=ne("svelte-u9bgzb",document.head);i=h(n,"META",{name:!0,content:!0}),n.forEach(t),r=p(e),b=h(e,"P",{}),N(b).forEach(t),d=p(e),A(s.$$.fragment,e),T=p(e),l=h(e,"P",{"data-svelte-h":!0}),g(l)!=="svelte-5fgwkf"&&(l.textContent=f),x=p(e),a=h(e,"P",{"data-svelte-h":!0}),g(a)!=="svelte-1vndh8y"&&(a.innerHTML=m),H=p(e),v=h(e,"P",{"data-svelte-h":!0}),g(v)!=="svelte-1xc515h"&&(v.innerHTML=X),C=p(e),_=h(e,"P",{"data-svelte-h":!0}),g(_)!=="svelte-e3qygk"&&(_.innerHTML=B),P=p(e),A(y.$$.fragment,e),L=p(e),w=h(e,"P",{"data-svelte-h":!0}),g(w)!=="svelte-r6bgbz"&&(w.innerHTML=K),E=p(e),k=h(e,"P",{"data-svelte-h":!0}),g(k)!=="svelte-xkt7xj"&&(k.innerHTML=V),Y=p(e),A($.$$.fragment,e),q=p(e),M=h(e,"P",{}),N(M).forEach(t),this.h()},h(){R(i,"name","hf:doc:metadata"),R(i,"content",ce)},m(e,n){oe(document.head,i),o(e,r,n),o(e,b,n),o(e,d,n),j(s,e,n),o(e,T,n),o(e,l,n),o(e,x,n),o(e,a,n),o(e,H,n),o(e,v,n),o(e,C,n),o(e,_,n),o(e,P,n),j(y,e,n),o(e,L,n),o(e,w,n),o(e,E,n),o(e,k,n),o(e,Y,n),j($,e,n),o(e,q,n),o(e,M,n),I=!0},p(e,[n]){const J={};n&2&&(J.$$scope={dirty:n,ctx:e}),y.$set(J)},i(e){I||(D(s.$$.fragment,e),D(y.$$.fragment,e),D($.$$.fragment,e),I=!0)},o(e){G(s.$$.fragment,e),G(y.$$.fragment,e),G($.$$.fragment,e),I=!1},d(e){e&&(t(r),t(b),t(d),t(T),t(l),t(x),t(a),t(H),t(v),t(C),t(_),t(P),t(L),t(w),t(E),t(k),t(Y),t(q),t(M)),t(i),z(s,e),z(y,e),z($,e)}}}const ce='{"title":"Hands-on exercise","local":"hands-on-exercise","sections":[],"depth":1}';function he(S){return W(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class me extends ee{constructor(i){super(),te(this,i,he,le,Q,{})}}export{me as component};
