Skip to content

Instantly share code, notes, and snippets.

@kurianbenoy
Last active April 6, 2022 16:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kurianbenoy/346090c325dcf4f8f77ec3fbda3f0f99 to your computer and use it in GitHub Desktop.
Save kurianbenoy/346090c325dcf4f8f77ec3fbda3f0f99 to your computer and use it in GitHub Desktop.
supported = ["a", "b", "c", "en", "ta"]
def load_model(source, target):
if source == target:
raise ModelNotSupported("Hello how are you")
if source in supported:
if source == "en":
return ("t", "t")
else:
raise ModelNotSupported("Language pair not available")
def predict_raw():
try:
tokenizer, model = load_model("en", "hello")
return model
except ModelNotSupported as e:
return {"inputerror": e}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment