File size: 1,567 Bytes
bcfd8ed
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width">
    <title>Sema Translator</title>
    <link rel="stylesheet" href="static/style.css" />
    <py-script src="modules/flores200_codes.py"></py-script>
</head>
<body>
    <div class="Header">
        <h1>Sema Translator</h1>
        <p>Unlock the Power of Global Communication with Sema Translator! Seamlessly bridging language barriers. With support for over 200 languages, Sema Translator opens up a realm of possibilities for building truly global applications.</p>
        
    </div>
    
    <div class="LanguageDropdown" style="text-align:center">
            <h2>Select a Language:</h2>
            <select id="languageSelect">
                {"".join(f"<option value='{code}'>{lang} - {code}</option>" for lang, code in flores_codes.items())}
            </select>
    </div>
    
    <div class="instructions">
        <p>Use the following python code to access the api endpoint</p>
        <pre style="text-align: left;">
import requests

url = "{public_url}/translate/"
data = {
    "userinput": "rũcinĩ rwega, niwokĩra wega?",
    "target_lang": "eng_Latn",
}

response = requests.post(url, json=data)
result = response.json()

print(result)

source_language = result['source_language']
print("Source Language:", source_language)

translation = result['translated_text']
print("Translated text:", translation)
        </pre>
    </div>
    
    <div class="footer">
        <h1>Created by Lewis Kamau Kiamru</h1>
    </div>
</body>
</html>