Spaces:
Running
Running
<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> |