import{s as Z,o as ee,n as te}from"../chunks/scheduler.cd324960.js";import{S as ne,i as oe,e as p,s as h,c as j,h as ae,a as f,d as n,b as u,f as W,g as z,j as y,k as X,l as se,m as o,n as A,t as D,o as G,p as F,q as O,r as R}from"../chunks/index.d5c3adcc.js";import{T as ie}from"../chunks/Tip.889bec11.js";import{C as re,H as le,E as ce}from"../chunks/MermaidChart.svelte_svelte_type_style_lang.92ea4747.js";function he(C){let i,r,b="requirements.txt",g,s,x="transformers",l,c,m="<code>git+https://github.com/hollance/transformers.git@6900e8ba6532162a8613d2270ec2286c3f58f57b</code>";return{c(){i=O(`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=p("a"),r.textContent=b,g=O(`
    file of your demo to install `),s=p("code"),s.textContent=x,l=O(` from the PR branch:
    `),c=p("p"),c.innerHTML=m,this.h()},l(a){i=R(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=f(a,"A",{href:!0,"data-svelte-h":!0}),y(r)!=="svelte-l0vtp8"&&(r.textContent=b),g=R(a,`
    file of your demo to install `),s=f(a,"CODE",{"data-svelte-h":!0}),y(s)!=="svelte-olzpwg"&&(s.textContent=x),l=R(a,` from the PR branch:
    `),c=f(a,"P",{"data-svelte-h":!0}),y(c)!=="svelte-1oo2kle"&&(c.innerHTML=m),this.h()},h(){X(r,"href","https://huggingface.co/spaces/course-demos/speech-to-speech-translation/blob/a03175878f522df7445290d5508bfb5c5178f787/requirements.txt#L2")},m(a,d){o(a,i,d),o(a,r,d),o(a,g,d),o(a,s,d),o(a,l,d),o(a,c,d)},p:te,d(a){a&&(n(i),n(r),n(g),n(s),n(l),n(c))}}}function ue(C){let i,r,b,g,s,x,l,c,m,a=`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.`,d,v,B=`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,_,K=`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!`,L,w,V=`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,T,E,$,J=`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.`,q,k,N=`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,M,I,S,U;return s=new re({props:{containerStyle:"float: right; margin-left: 10px; display: inline-flex; position: relative; z-index: 10;"}}),l=new le({props:{title:"Hands-on exercise",local:"hands-on-exercise",headingTag:"h1"}}),T=new ie({props:{$$slots:{default:[he]},$$scope:{ctx:C}}}),M=new ce({props:{source:"https://github.com/huggingface/audio-transformers-course/blob/main/chapters/en/chapter7/hands_on.mdx"}}),{c(){i=p("meta"),r=h(),b=p("p"),g=h(),j(s.$$.fragment),x=h(),j(l.$$.fragment),c=h(),m=p("p"),m.textContent=a,d=h(),v=p("p"),v.innerHTML=B,H=h(),_=p("p"),_.innerHTML=K,L=h(),w=p("p"),w.innerHTML=V,P=h(),j(T.$$.fragment),E=h(),$=p("p"),$.innerHTML=J,q=h(),k=p("p"),k.innerHTML=N,Y=h(),j(M.$$.fragment),I=h(),S=p("p"),this.h()},l(e){const t=ae("svelte-u9bgzb",document.head);i=f(t,"META",{name:!0,content:!0}),t.forEach(n),r=u(e),b=f(e,"P",{}),W(b).forEach(n),g=u(e),z(s.$$.fragment,e),x=u(e),z(l.$$.fragment,e),c=u(e),m=f(e,"P",{"data-svelte-h":!0}),y(m)!=="svelte-5fgwkf"&&(m.textContent=a),d=u(e),v=f(e,"P",{"data-svelte-h":!0}),y(v)!=="svelte-1vndh8y"&&(v.innerHTML=B),H=u(e),_=f(e,"P",{"data-svelte-h":!0}),y(_)!=="svelte-1xc515h"&&(_.innerHTML=K),L=u(e),w=f(e,"P",{"data-svelte-h":!0}),y(w)!=="svelte-e3qygk"&&(w.innerHTML=V),P=u(e),z(T.$$.fragment,e),E=u(e),$=f(e,"P",{"data-svelte-h":!0}),y($)!=="svelte-r6bgbz"&&($.innerHTML=J),q=u(e),k=f(e,"P",{"data-svelte-h":!0}),y(k)!=="svelte-xkt7xj"&&(k.innerHTML=N),Y=u(e),z(M.$$.fragment,e),I=u(e),S=f(e,"P",{}),W(S).forEach(n),this.h()},h(){X(i,"name","hf:doc:metadata"),X(i,"content",pe)},m(e,t){se(document.head,i),o(e,r,t),o(e,b,t),o(e,g,t),A(s,e,t),o(e,x,t),A(l,e,t),o(e,c,t),o(e,m,t),o(e,d,t),o(e,v,t),o(e,H,t),o(e,_,t),o(e,L,t),o(e,w,t),o(e,P,t),A(T,e,t),o(e,E,t),o(e,$,t),o(e,q,t),o(e,k,t),o(e,Y,t),A(M,e,t),o(e,I,t),o(e,S,t),U=!0},p(e,[t]){const Q={};t&2&&(Q.$$scope={dirty:t,ctx:e}),T.$set(Q)},i(e){U||(D(s.$$.fragment,e),D(l.$$.fragment,e),D(T.$$.fragment,e),D(M.$$.fragment,e),U=!0)},o(e){G(s.$$.fragment,e),G(l.$$.fragment,e),G(T.$$.fragment,e),G(M.$$.fragment,e),U=!1},d(e){e&&(n(r),n(b),n(g),n(x),n(c),n(m),n(d),n(v),n(H),n(_),n(L),n(w),n(P),n(E),n($),n(q),n(k),n(Y),n(I),n(S)),n(i),F(s,e),F(l,e),F(T,e),F(M,e)}}}const pe='{"title":"Hands-on exercise","local":"hands-on-exercise","sections":[],"depth":1}';function fe(C){return ee(()=>{new URLSearchParams(window.location.search).get("fw")}),[]}class be extends ne{constructor(i){super(),oe(this,i,fe,ue,Z,{})}}export{be as component};
