noahsettersten
commited on
Commit
•
a227b91
1
Parent(s):
69f8a70
chore: Namespace serving child processes
Browse files
lib/medical_transcription/application.ex
CHANGED
@@ -25,9 +25,9 @@ defmodule MedicalTranscription.Application do
|
|
25 |
{Phoenix.PubSub, name: MedicalTranscription.PubSub},
|
26 |
# Start the Finch HTTP client for sending emails
|
27 |
{Finch, name: MedicalTranscription.Finch},
|
28 |
-
serving_child_spec(TranscriptionServing, transcription_serving, 4),
|
29 |
-
serving_child_spec(TokenClassificationServing, token_classification_serving, 1),
|
30 |
-
{Nx.Serving, serving: text_embedding_serving, name: TextEmbeddingServing},
|
31 |
# Start a worker by calling: MedicalTranscription.Worker.start_link(arg)
|
32 |
# {MedicalTranscription.Worker, arg},
|
33 |
# Start to serve requests, typically the last entry
|
|
|
25 |
{Phoenix.PubSub, name: MedicalTranscription.PubSub},
|
26 |
# Start the Finch HTTP client for sending emails
|
27 |
{Finch, name: MedicalTranscription.Finch},
|
28 |
+
serving_child_spec(MedicalTranscription.TranscriptionServing, transcription_serving, 4),
|
29 |
+
serving_child_spec(MedicalTranscription.TokenClassificationServing, token_classification_serving, 1),
|
30 |
+
{Nx.Serving, serving: text_embedding_serving, name: MedicalTranscription.TextEmbeddingServing},
|
31 |
# Start a worker by calling: MedicalTranscription.Worker.start_link(arg)
|
32 |
# {MedicalTranscription.Worker, arg},
|
33 |
# Start to serve requests, typically the last entry
|
lib/medical_transcription/transcriber.ex
CHANGED
@@ -39,7 +39,7 @@ defmodule MedicalTranscription.Transcriber do
|
|
39 |
end
|
40 |
|
41 |
defp stream_transcription(audio_file_path) do
|
42 |
-
TranscriptionServing
|
43 |
|> Nx.Serving.batched_run({:file, audio_file_path})
|
44 |
|> Stream.with_index()
|
45 |
end
|
|
|
39 |
end
|
40 |
|
41 |
defp stream_transcription(audio_file_path) do
|
42 |
+
MedicalTranscription.TranscriptionServing
|
43 |
|> Nx.Serving.batched_run({:file, audio_file_path})
|
44 |
|> Stream.with_index()
|
45 |
end
|
lib/medical_transcription/utilities.ex
CHANGED
@@ -5,7 +5,7 @@ defmodule MedicalTranscription.Utilities do
|
|
5 |
|
6 |
@doc "Creates a vector embedding for text using the text embedding serving in the application's supervision tree."
|
7 |
def compute_vector_as_list(text) do
|
8 |
-
TextEmbeddingServing
|
9 |
|> Nx.Serving.batched_run(text)
|
10 |
|> Map.get(:embedding)
|
11 |
|> Nx.to_flat_list()
|
|
|
5 |
|
6 |
@doc "Creates a vector embedding for text using the text embedding serving in the application's supervision tree."
|
7 |
def compute_vector_as_list(text) do
|
8 |
+
MedicalTranscription.TextEmbeddingServing
|
9 |
|> Nx.Serving.batched_run(text)
|
10 |
|> Map.get(:embedding)
|
11 |
|> Nx.to_flat_list()
|
lib/medical_transcription_web/components/transcription_text_component.ex
CHANGED
@@ -65,7 +65,9 @@ defmodule MedicalTranscriptionWeb.Components.TranscriptionTextComponent do
|
|
65 |
|
66 |
defp find_keywords(live_view_pid, text) do
|
67 |
# First, we use token classification to determine parts of speech and then retrieve the verb and adjective+noun phrases.
|
68 |
-
%{entities: entities} =
|
|
|
|
|
69 |
phrases = AudioTagger.KeywordFinder.cleanup_phrases(entities)
|
70 |
|
71 |
# Then, we use one of two processes to determine which to show as keywords:
|
|
|
65 |
|
66 |
defp find_keywords(live_view_pid, text) do
|
67 |
# First, we use token classification to determine parts of speech and then retrieve the verb and adjective+noun phrases.
|
68 |
+
%{entities: entities} =
|
69 |
+
Nx.Serving.batched_run(MedicalTranscription.TokenClassificationServing, text)
|
70 |
+
|
71 |
phrases = AudioTagger.KeywordFinder.cleanup_phrases(entities)
|
72 |
|
73 |
# Then, we use one of two processes to determine which to show as keywords:
|