mgbam commited on
Commit
0985385
·
verified ·
1 Parent(s): 159beb2

Create test_translation.py

Browse files
Files changed (1) hide show
  1. test_translation.py +24 -0
test_translation.py ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # test_translation.py
2
+ from translation_models import translate, LANGUAGE_CODES, detect_language
3
+
4
+ # Sample text
5
+ sample_text = (
6
+ "1. Detailed Description:\n"
7
+ "- Image: Chest X-ray.\n"
8
+ "- View: Likely a posteroanterior (PA) view.\n\n"
9
+ "2. Key Findings:\n"
10
+ "- Cardiomegaly.\n"
11
+ "- Consolidation in lung fields.\n\n"
12
+ "3. Potential Differential Diagnoses:\n"
13
+ " 1. Pulmonary Edema\n"
14
+ " 2. Pneumonia\n\n"
15
+ "4. Reasoning for Top Diagnosis:\n"
16
+ "The findings suggest severe pneumonia."
17
+ )
18
+
19
+ # Test auto-detection
20
+ print("Detected language code:", detect_language(sample_text))
21
+
22
+ # Test translation from English to Spanish
23
+ translated = translate(sample_text, "Spanish", "English")
24
+ print("Translation (Spanish):\n", translated)