boazchung commited on
Commit
4962d88
1 Parent(s): 3402263

Update translation.html

Browse files
Files changed (1) hide show
  1. translation.html +2 -21
translation.html CHANGED
@@ -104,16 +104,14 @@
104
  const model = document.getElementById("model").value.trim();
105
  const prompt = document.getElementById("prompt").value.trim();
106
  document.getElementById("logs").textContent = "";
107
- //await (let result of hf.tanslation({
108
  let result = await hf.translation({
109
  model,
110
  inputs: prompt
111
  }, {
112
  use_cache: false
113
- }); //{
114
- //document.getElementById("logs").textContent += output.token.text;
115
  document.getElementById("logs").innerText = JSON.stringify(result["translation_text"], null, 2);
116
- //}
117
  } catch (err) {
118
  alert("Error: " + err.message);
119
  } finally {
@@ -122,23 +120,6 @@
122
  }
123
  window.launch = launch;
124
 
125
- /*
126
- async function translateText() {
127
- const textFieldValue = document.getElementById("translationText").value.trim();
128
-
129
- let result = await translator(textFieldValue, {
130
- src_lang: 'hin_Deva', // Hindi
131
- tgt_lang: 'fra_Latn', // French
132
- });
133
-
134
- document.getElementById("outputArea").innerText = JSON.stringify(result, null, 2);
135
- }
136
-
137
- await inference.translation({
138
- model: 't5-base',
139
- inputs: 'My name is Wolfgang and I live in Amsterdam'
140
- })
141
- */
142
  </script>
143
  </body>
144
  </html>
 
104
  const model = document.getElementById("model").value.trim();
105
  const prompt = document.getElementById("prompt").value.trim();
106
  document.getElementById("logs").textContent = "";
107
+
108
  let result = await hf.translation({
109
  model,
110
  inputs: prompt
111
  }, {
112
  use_cache: false
113
+ });
 
114
  document.getElementById("logs").innerText = JSON.stringify(result["translation_text"], null, 2);
 
115
  } catch (err) {
116
  alert("Error: " + err.message);
117
  } finally {
 
120
  }
121
  window.launch = launch;
122
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
123
  </script>
124
  </body>
125
  </html>