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

Unexpected keyword argument 'source' #87

Open
didpublishing opened this issue Nov 3, 2023 · 8 comments
Open

Unexpected keyword argument 'source' #87

didpublishing opened this issue Nov 3, 2023 · 8 comments

Comments

@didpublishing
Copy link

TypeError: Audio.init() got an unexpected keyword argument 'source'
I have no idea what to do from here.

@Durlecode
Copy link

I encountered the same problem, I managed to resolve it by renaming the source parameter to sources at lines 366 & 381 (it's an array now) in webui.py, see 4.0.0 Gradio changelog (Renames source param in gr.Audio and gr.Video to sources)

Then there is another problem, it concerns the _js parameter line 444, you need to rename it to js, see JS Param #6137

I don't know if this could help anyone but I finally have access to the web ui. 😅

@cnwinds
Copy link

cnwinds commented Nov 7, 2023

pip install gradio==3.28.3
to fix the promble.

@Fluxkom
Copy link

Fluxkom commented Nov 16, 2023

I had the same error, upgraded to gradio 3.28.3, now the ui is loading, but when I generate, nothing happens, I've let it run for 360s on a 4090.
Anyway to check what is happening here under the hood?

@Regostratos
Copy link

I encountered the same problem, I managed to resolve it by renaming the source parameter to sources at lines 366 & 381 (it's an array now) in webui.py, see 4.0.0 Gradio changelog (Renames source param in gr.Audio and gr.Video to sources)

Then there is another problem, it concerns the _js parameter line 444, you need to rename it to js, see JS Param #6137

I don't know if this could help anyone but I finally have access to the web ui. 😅

This worked thanks, i updated to Gradio 4.4 as well.

@maepopi
Copy link

maepopi commented Nov 21, 2023

I encountered the same problem, I managed to resolve it by renaming the source parameter to sources at lines 366 & 381 (it's an array now) in webui.py, see 4.0.0 Gradio changelog (Renames source param in gr.Audio and gr.Video to sources)

Then there is another problem, it concerns the _js parameter line 444, you need to rename it to js, see JS Param #6137

I don't know if this could help anyone but I finally have access to the web ui. 😅

Worked for me as well, thanks!

@donaldafeith
Copy link

donaldafeith commented Nov 23, 2023

I had the same error, upgraded to gradio 3.28.3, now the ui is loading, but when I generate, nothing happens, I've let it run for 360s on a 4090. Anyway to check what is happening here under the hood?

Same is happening as well. I started mauling the code last night and seeing what I could find. (As I hate CLI only apps. I really appreciate a gui and I know others do as well. Since I spend my whole workday staring at CLI and code... I'd much rather use a gui. :D )

So, I redid a portion of the webui.py

Changing source to sources as stated above by Durlecode

But I also changed out

button_stop_generation.click(fn=None, inputs=None, outputs=None, cancels=[gen_click])
# Javascript hack to display modal confirmation dialog
js = "(x) => confirm('Are you sure? This will remove all files from output folder')"
button_delete_files.click(None, None, hidden_checkbox, _js=js)
hidden_checkbox.change(delete_output_files, [hidden_checkbox], [hidden_checkbox])

And changed that block of code to

# Function to confirm file deletion
def confirm_delete(confirmation):
    if confirmation:
        delete_output_files()
    else:
        print("Deletion cancelled.")
    return None

button_stop_generation.click(fn=None, inputs=None, outputs=None, cancels=[gen_click])
confirm_deletion_button = gr.Button("Confirm Deletion")
button_delete_files.click(confirm_delete, inputs=confirm_deletion_button, outputs=None)
```
`


Replacing that code works well and I am using Gradio 4.4.0 at the moment. 


@HazySkies
Copy link

HazySkies commented Nov 27, 2023

I encountered the same problem, I managed to resolve it by renaming the source parameter to sources at lines 366 & 381 (it's an array now) in webui.py, see 4.0.0 Gradio changelog (Renames source param in gr.Audio and gr.Video to sources)
Changing source to sources doesn't seem to change anything
Then there is another problem, it concerns the _js parameter line 444, you need to rename it to js, see JS Param #6137

I'm confused about this, is the line button_delete_files.click(None, None, hidden_checkbox, _js=js) meant to end in js=js? Because defining something by the same thing doesn't seem right and resulted in the error TypeError: EventListenerMethod.__call__() got an unexpected keyword argument 'js'

But I also changed out

button_stop_generation.click(fn=None, inputs=None, outputs=None, cancels=[gen_click])
# Javascript hack to display modal confirmation dialog
js = "(x) => confirm('Are you sure? This will remove all files from output folder')"
button_delete_files.click(None, None, hidden_checkbox, _js=js)
hidden_checkbox.change(delete_output_files, [hidden_checkbox], [hidden_checkbox])

And changed that block of code to

# Function to confirm file deletion
def confirm_delete(confirmation):
    if confirmation:
        delete_output_files()
    else:
        print("Deletion cancelled.")
    return None

button_stop_generation.click(fn=None, inputs=None, outputs=None, cancels=[gen_click])
confirm_deletion_button = gr.Button("Confirm Deletion")
button_delete_files.click(confirm_delete, inputs=confirm_deletion_button, outputs=None)

Tried adding this but it resulted in:
File "/home/hazyskies/AI Downloads/Other Gits/Suno Bark - GUI/bark-gui/webui.py", line 453 swap_voice_button.click(swap_voice_from_audio, inputs=[swap_audio_filename, speaker_swap, swap_tokenizer_lang, swap_seed, swap_batchcount], outputs=output_swap) IndentationError: unexpected indent

Does this addition require 4.4.0 in order to not throw this error?

@donaldafeith
Copy link

donaldafeith commented Dec 1, 2023

Tried adding this but it resulted in: File "/home/hazyskies/AI Downloads/Other Gits/Suno Bark - GUI/bark-gui/webui.py", line 453 swap_voice_button.click(swap_voice_from_audio, inputs=[swap_audio_filename, speaker_swap, swap_tokenizer_lang, swap_seed, swap_batchcount], outputs=output_swap) IndentationError: unexpected indent

Does this addition require 4.4.0 in order to not throw this error?

This error IndentationError: unexpected indent is telling me you have an indent in your Python code that Python doesn't like. Check that block again and make sure your indents are where they should be. (I wouldn't be able to fix it without looking at it myself. :D )

If you don't have any issues otherwise (it isn't throwing incompatibility issues) you should be fine. Just fix your indent. :D

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

No branches or pull requests

8 participants