Spaces:
Sleeping
Sleeping
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,8 @@ df['ISO 639-1'] = df['ISO 639-1'].str.strip()
|
|
14 |
language_options = [(row['ISO 639-1'], f"{row['ISO 639-1']} - {row['Language Name']}") for index, row in df.iterrows()]
|
15 |
|
16 |
def translate_text(text, source_language_code, target_language_code):
|
|
|
|
|
17 |
# Construct model name using ISO 639-1 codes
|
18 |
model_name = f"Helsinki-NLP/opus-mt-{source_language_code}-{target_language_code}"
|
19 |
if source_language_code == target_language_code:
|
|
|
14 |
language_options = [(row['ISO 639-1'], f"{row['ISO 639-1']} - {row['Language Name']}") for index, row in df.iterrows()]
|
15 |
|
16 |
def translate_text(text, source_language_code, target_language_code):
|
17 |
+
source_language_code = source_language.split(' - ')[0].strip()
|
18 |
+
target_language_code = target_language.split(' - ')[0].strip()
|
19 |
# Construct model name using ISO 639-1 codes
|
20 |
model_name = f"Helsinki-NLP/opus-mt-{source_language_code}-{target_language_code}"
|
21 |
if source_language_code == target_language_code:
|