Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Gradio deprecated methods in 3.mdx #778

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

renweizhukov
Copy link

Replace the deprecated methods by those in Gradio 5.13.2:

  1. gr.Textbox(type="number") --> gr.Number().
  2. gr.Audio covers both microphone and file upload without specifying source.

Error about `gr.Textbox(type="number"):

Device set to use cuda:0
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[8], line 21
     14     transcription = model(audio)["text"]
     15     return transcription
     18 gr.Interface(
     19     fn=transcribe_audio,
     20     inputs=[
---> 21         gr.Audio(source="microphone", type="filepath", optional=True),
     22         gr.Audio(source="upload", type="filepath", optional=True),
     23     ],
     24     outputs="text",
     25 ).launch()

File ~/anaconda3/envs/llm/lib/python3.12/site-packages/gradio/component_meta.py:179, in updateable.<locals>.wrapper(*args, **kwargs)
    177     return None
    178 else:
--> 179     return fn(self, **kwargs)

TypeError: Audio.__init__() got an unexpected keyword argument 'source'

Error about gr.Audio(source=""):

Device set to use cuda:0
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[8], line 21
     14     transcription = model(audio)["text"]
     15     return transcription
     18 gr.Interface(
     19     fn=transcribe_audio,
     20     inputs=[
---> 21         gr.Audio(source="microphone", type="filepath", optional=True),
     22         gr.Audio(source="upload", type="filepath", optional=True),
     23     ],
     24     outputs="text",
     25 ).launch()

File ~/anaconda3/envs/llm/lib/python3.12/site-packages/gradio/component_meta.py:179, in updateable.<locals>.wrapper(*args, **kwargs)
    177     return None
    178 else:
--> 179     return fn(self, **kwargs)

TypeError: Audio.__init__() got an unexpected keyword argument 'source'

Replace the deprecated methods by those in Gradio 5.13.2:

1. `gr.Textbox(type="number")` --> `gr.Number()`.
2. `gr.Audio` covers both microphone and file upload without specifying `source`.
@HuggingFaceDocBuilderDev

The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants