Spaces:
Runtime error
Runtime error
tonic
commited on
Commit
·
2f0d9bf
1
Parent(s):
be7cfd1
bug fixes
Browse files
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,
|
| 62 |
"""
|
| 63 |
-
|
| 64 |
"""
|
| 65 |
-
|
|
|
|
|
|
|
|
|
|
| 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,
|