From b809765e2bf5a83a86048ee4c7933e5ce079fc48 Mon Sep 17 00:00:00 2001 From: Maria Magdalena Balos <84422975+mbalos16@users.noreply.github.com> Date: Fri, 11 Oct 2024 15:23:59 +0100 Subject: [PATCH] Update old function params As per Gradio Documentation, some of the params aren't used anymore and the code doesn't work. - Audio source now is sources and gets a list - Audio doesn't have an 'optional' parameter - Textbox type gets just ['text', 'password', 'email'] not 'number' --- chapters/en/chapter9/3.mdx | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/chapters/en/chapter9/3.mdx b/chapters/en/chapter9/3.mdx index 46bc2d88f..1dc1fee48 100644 --- a/chapters/en/chapter9/3.mdx +++ b/chapters/en/chapter9/3.mdx @@ -64,7 +64,7 @@ def reverse_audio(audio): return reversed_audio -mic = gr.Audio(source="microphone", type="numpy", label="Speak here...") +mic = gr.Audio(sources=["microphone"], type="numpy", label="Speak here...") gr.Interface(reverse_audio, mic, "audio").launch() ``` @@ -112,7 +112,7 @@ gr.Interface( [ gr.Dropdown(notes, type="index"), gr.Slider(minimum=4, maximum=6, step=1), - gr.Textbox(type="number", value=1, label="Duration in seconds"), + gr.Textbox(value=1, label="Duration in seconds"), ], "audio", ).launch() @@ -167,8 +167,8 @@ def transcribe_audio(mic=None, file=None): gr.Interface( fn=transcribe_audio, inputs=[ - gr.Audio(source="microphone", type="filepath", optional=True), - gr.Audio(source="upload", type="filepath", optional=True), + gr.Audio(sources=["microphone"], type="filepath"), + gr.Audio(sources=["upload"], type="filepath"), ], outputs="text", ).launch() @@ -183,4 +183,4 @@ That's it! You can now use this interface to transcribe audio. Notice here that by passing in the `optional` parameter as `True`, we allow the user to either provide a microphone or an audio file (or neither, but that will return an error message). -Keep going to see how to share your interface with others! \ No newline at end of file +Keep going to see how to share your interface with others!