timgremore
commited on
Commit
•
6dfbade
1
Parent(s):
a5ed8ce
chore: Unwrap transcription serving from FLAME
Browse filesTesting Fly GPU with FLAME resulted in an issue where Bumblebee didn't have access to the cache directory configured in our container. Solveable but FLAME isn't necessary to test GPU impact on performance.
lib/medicode/transcription_server.ex
CHANGED
@@ -155,23 +155,19 @@ defmodule Medicode.TranscriptionServer do
|
|
155 |
# complete sentences based on punctuation. We may want to suggest codes for the entire audio as a single piece as
|
156 |
# well
|
157 |
defp stream_transcription_and_search(audio_file_path) do
|
158 |
-
|
159 |
-
|
160 |
-
|
161 |
-
|
162 |
-
|
163 |
-
|
164 |
-
|
165 |
-
|
166 |
-
|
167 |
-
|
168 |
-
}
|
169 |
-
|
170 |
-
send(target_pid, {:chunk, result})
|
171 |
-
end)
|
172 |
-
|
173 |
-
send(target_pid, :finished)
|
174 |
end)
|
|
|
|
|
175 |
end
|
176 |
|
177 |
defp format_timestamp(seconds) when is_nil(seconds), do: nil
|
|
|
155 |
# complete sentences based on punctuation. We may want to suggest codes for the entire audio as a single piece as
|
156 |
# well
|
157 |
defp stream_transcription_and_search(audio_file_path) do
|
158 |
+
Medicode.TranscriptionServing
|
159 |
+
|> Nx.Serving.batched_run({:file, audio_file_path})
|
160 |
+
|> Enum.each(fn chunk ->
|
161 |
+
result = %{
|
162 |
+
start_mark: format_timestamp(chunk.start_timestamp_seconds),
|
163 |
+
end_mark: format_timestamp(chunk.end_timestamp_seconds),
|
164 |
+
text: chunk.text
|
165 |
+
}
|
166 |
+
|
167 |
+
send(self(), {:chunk, result})
|
|
|
|
|
|
|
|
|
|
|
|
|
168 |
end)
|
169 |
+
|
170 |
+
send(self(), :finished)
|
171 |
end
|
172 |
|
173 |
defp format_timestamp(seconds) when is_nil(seconds), do: nil
|