Skip to content

Commit

Permalink
Update old function params
Browse files Browse the repository at this point in the history
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'
  • Loading branch information
mbalos16 authored Oct 11, 2024
1 parent 1bda24c commit b809765
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions chapters/en/chapter9/3.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -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()
```

Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -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()
Expand All @@ -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!
Keep going to see how to share your interface with others!

0 comments on commit b809765

Please sign in to comment.