ggerganov commited on
Commit
33a4590
·
unverified ·
1 Parent(s): 75f9881

talk.wasm : update video link + some minor fixes

Browse files
examples/talk.wasm/emscripten.cpp CHANGED
@@ -135,11 +135,9 @@ void talk_main(size_t index) {
135
 
136
  talk_set_status("processing ...");
137
 
138
- g_force_speak = false;
139
-
140
  t_last = t_now;
141
 
142
- {
143
  const auto t_start = std::chrono::high_resolution_clock::now();
144
 
145
  int ret = whisper_full(ctx, wparams, pcmf32.data(), pcmf32.size());
@@ -156,18 +154,22 @@ void talk_main(size_t index) {
156
  {
157
  std::string text_heard;
158
 
159
- const int n_segments = whisper_full_n_segments(ctx);
160
- for (int i = n_segments - 1; i < n_segments; ++i) {
161
- const char * text = whisper_full_get_segment_text(ctx, i);
 
162
 
163
- const int64_t t0 = whisper_full_get_segment_t0(ctx, i);
164
- const int64_t t1 = whisper_full_get_segment_t1(ctx, i);
165
 
166
- printf ("[%s --> %s] %s\n", to_timestamp(t0).c_str(), to_timestamp(t1).c_str(), text);
167
 
168
- text_heard += text;
 
169
  }
170
 
 
 
171
  // remove text between brackets using regex
172
  {
173
  std::regex re("\\[.*?\\]");
 
135
 
136
  talk_set_status("processing ...");
137
 
 
 
138
  t_last = t_now;
139
 
140
+ if (!g_force_speak) {
141
  const auto t_start = std::chrono::high_resolution_clock::now();
142
 
143
  int ret = whisper_full(ctx, wparams, pcmf32.data(), pcmf32.size());
 
154
  {
155
  std::string text_heard;
156
 
157
+ if (!g_force_speak) {
158
+ const int n_segments = whisper_full_n_segments(ctx);
159
+ for (int i = n_segments - 1; i < n_segments; ++i) {
160
+ const char * text = whisper_full_get_segment_text(ctx, i);
161
 
162
+ const int64_t t0 = whisper_full_get_segment_t0(ctx, i);
163
+ const int64_t t1 = whisper_full_get_segment_t1(ctx, i);
164
 
165
+ printf ("[%s --> %s] %s\n", to_timestamp(t0).c_str(), to_timestamp(t1).c_str(), text);
166
 
167
+ text_heard += text;
168
+ }
169
  }
170
 
171
+ g_force_speak = false;
172
+
173
  // remove text between brackets using regex
174
  {
175
  std::regex re("\\[.*?\\]");
examples/talk.wasm/gpt-2.cpp CHANGED
@@ -812,9 +812,9 @@ I'm fine, thanks. How are you?
812
  Thanks, I'm fine too. What are you doing?
813
  I'm just sitting here.
814
  It's a lovely day, isn't it?
815
- Yes, it is.
816
- Did you know that I'm a robot?
817
- I wasn't aware of that.
818
  )";
819
 
820
  std::mt19937 rng;
 
812
  Thanks, I'm fine too. What are you doing?
813
  I'm just sitting here.
814
  It's a lovely day, isn't it?
815
+ Yes, it is. I love the weather this time of year.
816
+ I wish it would rain a little bit.
817
+ Me too.
818
  )";
819
 
820
  std::mt19937 rng;
examples/talk.wasm/index-tmpl.html CHANGED
@@ -143,7 +143,7 @@
143
 
144
  <br><br>
145
 
146
- Here is a short video of the demo in action: <a href="https://youtu.be/2om-7tFMaNs">https://youtu.be/2om-7tFMaNs</a>
147
 
148
  <br><br>
149
 
@@ -507,7 +507,7 @@
507
  context = new AudioContext({
508
  sampleRate: 16000,
509
  channelCount: 1,
510
- echoCancellation: true,
511
  autoGainControl: true,
512
  noiseSuppression: true,
513
  });
 
143
 
144
  <br><br>
145
 
146
+ Here is a short video of the demo in action: <a href="https://youtu.be/LeWKl8t1-Hc">https://youtu.be/LeWKl8t1-Hc</a>
147
 
148
  <br><br>
149
 
 
507
  context = new AudioContext({
508
  sampleRate: 16000,
509
  channelCount: 1,
510
+ echoCancellation: false,
511
  autoGainControl: true,
512
  noiseSuppression: true,
513
  });