PB Unity
commited on
Upload RunWhisper.cs
Browse files- RunWhisper.cs +15 -5
RunWhisper.cs
CHANGED
@@ -39,12 +39,17 @@ public class RunWhisper : MonoBehaviour
|
|
39 |
// This is how many tokens you want. It can be adjusted.
|
40 |
const int maxTokens = 100;
|
41 |
|
42 |
-
//Special tokens
|
43 |
const int END_OF_TEXT = 50257;
|
44 |
const int START_OF_TRANSCRIPT = 50258;
|
45 |
const int ENGLISH = 50259;
|
46 |
-
const int
|
|
|
|
|
|
|
|
|
47 |
const int START_TIME = 50364;
|
|
|
48 |
|
49 |
Ops ops;
|
50 |
ITensorAllocator allocator;
|
@@ -85,9 +90,9 @@ public class RunWhisper : MonoBehaviour
|
|
85 |
spectroEngine = WorkerFactory.CreateWorker(backend, spectro);
|
86 |
|
87 |
outputTokens[0] = START_OF_TRANSCRIPT;
|
88 |
-
outputTokens[1] = ENGLISH
|
89 |
-
outputTokens[2] = TRANSCRIBE;
|
90 |
-
outputTokens[3] = START_TIME
|
91 |
currentToken = 3;
|
92 |
|
93 |
LoadAudio();
|
@@ -210,6 +215,11 @@ public class RunWhisper : MonoBehaviour
|
|
210 |
return !(('!' <= c && c <= '~') || ('�' <= c && c <= '�') || ('�' <= c && c <= '�'));
|
211 |
}
|
212 |
|
|
|
|
|
|
|
|
|
|
|
213 |
private void OnDestroy()
|
214 |
{
|
215 |
decoderEngine?.Dispose();
|
|
|
39 |
// This is how many tokens you want. It can be adjusted.
|
40 |
const int maxTokens = 100;
|
41 |
|
42 |
+
//Special tokens see added tokens file for details
|
43 |
const int END_OF_TEXT = 50257;
|
44 |
const int START_OF_TRANSCRIPT = 50258;
|
45 |
const int ENGLISH = 50259;
|
46 |
+
const int GERMAN = 50261;
|
47 |
+
const int FRENCH = 50265;
|
48 |
+
const int TRANSCRIBE = 50359; //for speech-to-text in specified language
|
49 |
+
const int TRANSLATE = 50358; //for speech-to-text then translate to English
|
50 |
+
const int NO_TIME_STAMPS = 50363;
|
51 |
const int START_TIME = 50364;
|
52 |
+
|
53 |
|
54 |
Ops ops;
|
55 |
ITensorAllocator allocator;
|
|
|
90 |
spectroEngine = WorkerFactory.CreateWorker(backend, spectro);
|
91 |
|
92 |
outputTokens[0] = START_OF_TRANSCRIPT;
|
93 |
+
outputTokens[1] = ENGLISH;// GERMAN;//FRENCH;//
|
94 |
+
outputTokens[2] = TRANSCRIBE; //TRANSLATE;//
|
95 |
+
outputTokens[3] = NO_TIME_STAMPS;// START_TIME;//
|
96 |
currentToken = 3;
|
97 |
|
98 |
LoadAudio();
|
|
|
215 |
return !(('!' <= c && c <= '~') || ('�' <= c && c <= '�') || ('�' <= c && c <= '�'));
|
216 |
}
|
217 |
|
218 |
+
private void OnApplicationQuit()
|
219 |
+
{
|
220 |
+
if (Input.GetKeyDown(KeyCode.Escape)) Application.Quit();
|
221 |
+
}
|
222 |
+
|
223 |
private void OnDestroy()
|
224 |
{
|
225 |
decoderEngine?.Dispose();
|