AlexVed commited on
Commit
c1901d7
·
verified ·
1 Parent(s): fdc81e6

Create index.html

Browse files
Files changed (1) hide show
  1. index.html +39 -0
index.html ADDED
@@ -0,0 +1,39 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+ <head>
4
+ <meta charset="UTF-8">
5
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
+ <title>English to Ukrainian Translator</title>
7
+ <style>
8
+ body { font-family: Arial, sans-serif; text-align: center; padding: 20px; }
9
+ textarea { width: 80%; height: 100px; margin: 10px; }
10
+ button { padding: 10px 20px; background: blue; color: white; border: none; cursor: pointer; }
11
+ #result { margin-top: 20px; font-size: 18px; font-weight: bold; }
12
+ </style>
13
+ </head>
14
+ <body>
15
+ <h1>English to Ukrainian Translator</h1>
16
+ <textarea id="inputText" placeholder="Enter English text..."></textarea>
17
+ <br>
18
+ <button onclick="translateText()">Translate</button>
19
+ <div id="result"></div>
20
+
21
+ <script>
22
+ function translateText() {
23
+ let text = document.getElementById("inputText").value;
24
+ if (!text) return;
25
+
26
+ fetch("/translate", {
27
+ method: "POST",
28
+ headers: { "Content-Type": "application/json" },
29
+ body: JSON.stringify({ text: text })
30
+ })
31
+ .then(response => response.json())
32
+ .then(data => {
33
+ document.getElementById("result").innerText = "Translation: " + data.translation;
34
+ })
35
+ .catch(error => console.error("Error:", error));
36
+ }
37
+ </script>
38
+ </body>
39
+ </html>