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

Filename doesn't work when saving a file #1

Closed
TheDarkTiger opened this issue Sep 26, 2022 · 6 comments
Closed

Filename doesn't work when saving a file #1

TheDarkTiger opened this issue Sep 26, 2022 · 6 comments

Comments

@TheDarkTiger
Copy link

TheDarkTiger commented Sep 26, 2022

Filename is unused in function "generate_ijt()", but should be used instead in fuction "say()"

Here is the fix:

diff --git a/fakeyou/fakeyou.py b/fakeyou/fakeyou.py
index 31c56a1..7566fc4 100644
--- a/fakeyou/fakeyou.py
+++ b/fakeyou/fakeyou.py
@@ -89,7 +89,7 @@ class FakeYou():

                return search(vjson=vjson,cjson=cjson)

-       def generate_ijt(self,text:str,ttsModelToken:str,filename:str="fakeyou.wav"):
+       def generate_ijt( self,text:str,ttsModelToken:str ):
                if self.v:
                        print("getting job token")
                payload={"uuid_idempotency_token":str(uuid4()),"tts_model_token":ttsModelToken,"inference_text":text}
@@ -128,8 +128,8 @@ class FakeYou():
                                raise TooManyRequests("Too many requests, try again later or use a proxy.")

        def say(self,text:str,ttsModelToken:str,filename:str="fakeyou.wav",cooldown:int=3):
-               ijt=self.generate_ijt(text=text,ttsModelToken=ttsModelToken,filename=filename)
-               return self.get_wav(ijt,cooldown=cooldown)
+               ijt=self.generate_ijt( text=text, ttsModelToken=ttsModelToken )
+               return self.get_wav( ijt, cooldown=cooldown, filename=filename )

        def get_tts_leaderboard(self):
                handler=self.session.get(self.baseurl+"leaderboard")
@FRIKIdelTO
Copy link

FRIKIdelTO commented Oct 18, 2022

That's right
Need to add filename argument to return in say function:

file: fakeyou.py (line 132)
return self.get_wav(ijt,cooldown=cooldown,filename=filename)

please, fix it ASAP

@TheDarkTiger
Copy link
Author

That's what the fix I proposed does, yes.
Maybe a pull request would be easier?
If so, I may do it.

@justlearntutors
Copy link

Same bug on my pc.
Change
return self.get_wav(ijt,cooldown=cooldown)
to
return self.get_wav(ijt,cooldown=cooldown,filename=filename)

@ohquared
Copy link

ohquared commented Nov 9, 2022

just rename the audio after it creates, only need to import os.
fy.say(text='text', ttsModelToken=token,cooldown=5)
os.rename('fakeyou.wav', 'name_final.wav')

@TheDarkTiger
Copy link
Author

@ohquared That's an horrible way to do it.
First because the function don't act as it should (as you can specify the name and it don't use it),
And second because renaming file without check if it was created or whatever is not good (and if the lib is updated later, your code will crash too).

Just save my fix as "fix.patch", and then invoke:
git apply fix.patch

@shards-7
Copy link
Owner

shards-7 commented Jan 5, 2023

thanks for letting me know, @unknownZandbak already fixed it and i merged the pull, if y'all interested to maintain this library with me, please DM me :

Telegram, Instagram : thedemonicat
Discord : thedemonicat#9335

@shards-7 shards-7 closed this as completed Jan 5, 2023
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

5 participants