in ember/create.py [0:0]
def select_model() -> ModelChoice:
choices = [str(choice) for choice in MODEL_CHOICES]
choices.append("Custom Model")
selected = questionary.select(
"Choose a model to export:",
choices=choices,
style=questionary.Style(
[
("qmark", "fg:green"),
("question", "bold"),
("choice", "fg:cyan"),
("pointer", "fg:green"),
("highlighted", "fg:green"),
]
),
).ask()
if selected.startswith("Custom"):
custom_id = questionary.text("Enter the model ID (org/name, use the ⎘ button on the Hub 🤗)").ask()
if "/" not in custom_id:
raise ValueError("Invalid model ID. Please use the format org/name")
custom_org, custom_model = custom_id.split("/")
return ModelChoice(custom_org, custom_model, "Custom Model")
else:
return next(choice for choice in MODEL_CHOICES if str(choice) == selected)