Advay-Singh commited on
Commit
f39f001
·
verified ·
1 Parent(s): 7856bf1

Update templates/translate.html

Browse files
Files changed (1) hide show
  1. templates/translate.html +104 -104
templates/translate.html CHANGED
@@ -1,105 +1,105 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
-
4
- <head>
5
- <meta charset="UTF-8">
6
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
- <title>Translate | TaskBot v1+ AI</title>
8
- <link rel="Icon" href="TaskBot logo.png">
9
- </head>
10
- <style>
11
- body {
12
- background-color: #2f2f2f;
13
- font-family: Arial, sans-serif;
14
- color: white;
15
- margin: 0;
16
- padding: 20px;
17
- }
18
-
19
- h1 {
20
- text-align: center;
21
- }
22
-
23
- input {
24
- width: 100%;
25
- border-radius: 50px;
26
- background-color: white;
27
- color: black;
28
- height: 40px;
29
- font-size: large;
30
- }
31
-
32
- label {
33
- color: white;
34
- }
35
-
36
- textarea {
37
- width: 100%;
38
- font-size: x-large;
39
- height: 100px;
40
- user-select: none;
41
- }
42
-
43
- button {
44
- width: 100px;
45
- height: 50px;
46
- text-align: center;
47
- float: right;
48
- }
49
-
50
- small {
51
- display: block;
52
- text-align: center;
53
- color: gray;
54
- }
55
- </style>
56
-
57
- <body>
58
-
59
- <h1>Translator</h1>
60
- <small>Powered by gemini-2.0-flash</small><br><br>
61
-
62
- <label for="question">Text:</label>
63
- <input type=" text" id="question" placeholder="Type your text here..."><br><br>
64
-
65
- <label for="from">Translate From: </label>
66
- <input type="text" id="from" style="width: 200px; height: auto;"><br><br><br>
67
- <label for="to">Translate To: </label>
68
- <input type="text" id="to" style="width: 200px; height: auto;"><br><br><br>
69
-
70
- <button onclick=answer() id="answer_button">Start Translating</button><br><br><br>
71
-
72
- <textarea name="answer" id="answer" placeholder="Your answer will be displayed here..."></textarea>
73
-
74
-
75
- <script>
76
- document.getElementById("from").value = "Auto Detect"
77
- async function answer() {
78
- document.getElementById("answer_button").disabled = true
79
- const userInput = document.getElementById('question').value;
80
- if (userInput.trim() === '') return;
81
- const question = userInput;
82
- const translate_from = document.getElementById("from").value;
83
- const translate_to = document.getElementById("to").value;
84
- const response = await fetch("/translate", {
85
- method: "POST",
86
- headers: {
87
- "Content-Type": "application/x-www-form-urlencoded"
88
- },
89
- body: new URLSearchParams({ question: question, translate_from: translate_from, translate_to: translate_to })
90
- });
91
- const data = await response.json();
92
- const answer_area = document.getElementById("answer");
93
- if (data.answer) {
94
- aiResponse = data.answer;
95
- answer_area.value = aiResponse
96
- } else if (data.error) {
97
- aiResponse = "Error: " + data.error;
98
- answer_area.value = aiResponse
99
- }
100
- document.getElementById("answer_button").disabled = false
101
- }
102
- </script>
103
- </body>
104
-
105
  </html>
 
1
+ <!DOCTYPE html>
2
+ <html lang="en">
3
+
4
+ <head>
5
+ <meta charset="UTF-8">
6
+ <meta name="viewport" content="width=device-width, initial-scale=1.0">
7
+ <title>Translate | TaskBot AI</title>
8
+ <link rel="Icon" href="TaskBot logo.png">
9
+ </head>
10
+ <style>
11
+ body {
12
+ background-color: #2f2f2f;
13
+ font-family: Arial, sans-serif;
14
+ color: white;
15
+ margin: 0;
16
+ padding: 20px;
17
+ }
18
+
19
+ h1 {
20
+ text-align: center;
21
+ }
22
+
23
+ input {
24
+ width: 100%;
25
+ border-radius: 50px;
26
+ background-color: white;
27
+ color: black;
28
+ height: 40px;
29
+ font-size: large;
30
+ }
31
+
32
+ label {
33
+ color: white;
34
+ }
35
+
36
+ textarea {
37
+ width: 100%;
38
+ font-size: x-large;
39
+ height: 100px;
40
+ user-select: none;
41
+ }
42
+
43
+ button {
44
+ width: 100px;
45
+ height: 50px;
46
+ text-align: center;
47
+ float: right;
48
+ }
49
+
50
+ small {
51
+ display: block;
52
+ text-align: center;
53
+ color: gray;
54
+ }
55
+ </style>
56
+
57
+ <body>
58
+
59
+ <h1>Translator</h1>
60
+ <small>Powered by gemini-2.0-flash</small><br><br>
61
+
62
+ <label for="question">Text:</label>
63
+ <input type=" text" id="question" placeholder="Type your text here..."><br><br>
64
+
65
+ <label for="from">Translate From: </label>
66
+ <input type="text" id="from" style="width: 200px; height: auto;"><br><br><br>
67
+ <label for="to">Translate To: </label>
68
+ <input type="text" id="to" style="width: 200px; height: auto;"><br><br><br>
69
+
70
+ <button onclick=answer() id="answer_button">Start Translating</button><br><br><br>
71
+
72
+ <textarea name="answer" id="answer" placeholder="Your answer will be displayed here..."></textarea>
73
+
74
+
75
+ <script>
76
+ document.getElementById("from").value = "Auto Detect"
77
+ async function answer() {
78
+ document.getElementById("answer_button").disabled = true
79
+ const userInput = document.getElementById('question').value;
80
+ if (userInput.trim() === '') return;
81
+ const question = userInput;
82
+ const translate_from = document.getElementById("from").value;
83
+ const translate_to = document.getElementById("to").value;
84
+ const response = await fetch("/translate", {
85
+ method: "POST",
86
+ headers: {
87
+ "Content-Type": "application/x-www-form-urlencoded"
88
+ },
89
+ body: new URLSearchParams({ question: question, translate_from: translate_from, translate_to: translate_to })
90
+ });
91
+ const data = await response.json();
92
+ const answer_area = document.getElementById("answer");
93
+ if (data.answer) {
94
+ aiResponse = data.answer;
95
+ answer_area.value = aiResponse
96
+ } else if (data.error) {
97
+ aiResponse = "Error: " + data.error;
98
+ answer_area.value = aiResponse
99
+ }
100
+ document.getElementById("answer_button").disabled = false
101
+ }
102
+ </script>
103
+ </body>
104
+
105
  </html>