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

Fix ModelManager.list_models() #3128

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 13 additions & 14 deletions TTS/utils/manage.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,6 @@ def _list_models(self, model_type, model_count=0):
def _list_for_model_type(self, model_type):
models_name_list = []
model_count = 1
model_type = "tts_models"
models_name_list.extend(self._list_models(model_type, model_count))
return models_name_list

Expand Down Expand Up @@ -298,22 +297,22 @@ def _set_model_item(self, model_name):
model_item = self.set_model_url(model_item)
return model_item, model_full_name, model, md5hash

def ask_tos(self, model_full_path):
@staticmethod
def ask_tos(model_full_path):
"""Ask the user to agree to the terms of service"""
tos_path = os.path.join(model_full_path, "tos_agreed.txt")
if not os.path.exists(tos_path):
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🤔 This whole if is gone?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The same condition is already checked in tos_agreed(), so no need to repeat it here (and if it were kept, a return True would be necessary after the if block actually).

Copy link
Contributor

@akx akx Oct 31, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, I see. (Also, it seems this wouldn't have taken the COQUI_TOS_AGREED envvar into account...)

print(" > You must agree to the terms of service to use this model.")
print(" | > Please see the terms of service at https://coqui.ai/cpml.txt")
print(' | > "I have read, understood and agreed the Terms and Conditions." - [y/n]')
answer = input(" | | > ")
if answer.lower() == "y":
with open(tos_path, "w") as f:
f.write("I have read, understood ad agree the Terms and Conditions.")
return True
else:
return False
print(" > You must agree to the terms of service to use this model.")
print(" | > Please see the terms of service at https://coqui.ai/cpml.txt")
print(' | > "I have read, understood and agreed to the Terms and Conditions." - [y/n]')
answer = input(" | | > ")
if answer.lower() == "y":
with open(tos_path, "w", encoding="utf-8") as f:
f.write("I have read, understood and agreed to the Terms and Conditions.")
return True
return False

def tos_agreed(self, model_item, model_full_path):
@staticmethod
def tos_agreed(model_item, model_full_path):
"""Check if the user has agreed to the terms of service"""
if "tos_required" in model_item and model_item["tos_required"]:
tos_path = os.path.join(model_full_path, "tos_agreed.txt")
Expand Down
Loading