tonic commited on
Commit
2f0d9bf
1 Parent(s): be7cfd1
Files changed (1) hide show
  1. app.py +6 -3
app.py CHANGED
@@ -58,11 +58,14 @@ def get_language_code(language_name):
58
  print(f"Language name '{language_name}' not found.")
59
  return None
60
 
61
- def translate_text(text, instructions=translatetextinst.format(input_language=inputlanguage)):
62
  """
63
- translates text.
64
  """
65
- prompt = f"{text}{instructions}"
 
 
 
66
  response = co.generate(
67
  model='c4ai-aya',
68
  prompt=prompt,
 
58
  print(f"Language name '{language_name}' not found.")
59
  return None
60
 
61
+ def translate_text(text, inputlanguage, target_language):
62
  """
63
+ Translates text.
64
  """
65
+ # Ensure you format the instruction string within the function body
66
+ instructions = translatetextinst.format(inputlanguage=inputlanguage)
67
+ producetext_formatted = producetext.format(target_language=target_language)
68
+ prompt = f"{text}{producetext_formatted}\n{instructions}"
69
  response = co.generate(
70
  model='c4ai-aya',
71
  prompt=prompt,