Skip to content

Instantly share code, notes, and snippets.

@aasthavar
Created April 19, 2023 13:00
Show Gist options
  • Select an option

  • Save aasthavar/4baf36fe236f07b67251b9dfaffc9bb9 to your computer and use it in GitHub Desktop.

Select an option

Save aasthavar/4baf36fe236f07b67251b9dfaffc9bb9 to your computer and use it in GitHub Desktop.
Inference Example
newline, bold, unbold = "\n", "\033[1m", "\033[0m"
text1 = "Translate to German: My name is Arthur"
text2 = "A step by step recipe to make bolognese pasta:"
for text in [text1, text2]:
query_response = query_endpoint(text.encode("utf-8"), endpoint_name=endpoint_name)
generated_text = parse_response(query_response)
print(
f"Inference:{newline}"
f"input text: {text}{newline}"
f"generated text: {bold}{generated_text}{unbold}{newline}"
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment