noahsettersten
commited on
Commit
•
48a456d
1
Parent(s):
b8101e2
refactor: Extract function for serving child specs
Browse files
lib/medical_transcription/application.ex
CHANGED
@@ -23,20 +23,8 @@ defmodule MedicalTranscription.Application do
|
|
23 |
{Phoenix.PubSub, name: MedicalTranscription.PubSub},
|
24 |
# Start the Finch HTTP client for sending emails
|
25 |
{Finch, name: MedicalTranscription.Finch},
|
26 |
-
|
27 |
-
|
28 |
-
serving: transcription_serving,
|
29 |
-
name: TranscriptionServing,
|
30 |
-
batch_size: 4,
|
31 |
-
batch_timeout: 100
|
32 |
-
},
|
33 |
-
{
|
34 |
-
Nx.Serving,
|
35 |
-
serving: token_classification_serving,
|
36 |
-
name: TokenClassificationServing,
|
37 |
-
batch_size: 1,
|
38 |
-
batch_timeout: 100
|
39 |
-
},
|
40 |
# Start a worker by calling: MedicalTranscription.Worker.start_link(arg)
|
41 |
# {MedicalTranscription.Worker, arg},
|
42 |
# Start to serve requests, typically the last entry
|
@@ -56,4 +44,11 @@ defmodule MedicalTranscription.Application do
|
|
56 |
MedicalTranscriptionWeb.Endpoint.config_change(changed, removed)
|
57 |
:ok
|
58 |
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
59 |
end
|
|
|
23 |
{Phoenix.PubSub, name: MedicalTranscription.PubSub},
|
24 |
# Start the Finch HTTP client for sending emails
|
25 |
{Finch, name: MedicalTranscription.Finch},
|
26 |
+
serving_child_spec(TranscriptionServing, transcription_serving, 4),
|
27 |
+
serving_child_spec(TokenClassificationServing, token_classification_serving, 1),
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
28 |
# Start a worker by calling: MedicalTranscription.Worker.start_link(arg)
|
29 |
# {MedicalTranscription.Worker, arg},
|
30 |
# Start to serve requests, typically the last entry
|
|
|
44 |
MedicalTranscriptionWeb.Endpoint.config_change(changed, removed)
|
45 |
:ok
|
46 |
end
|
47 |
+
|
48 |
+
defp serving_child_spec(name, serving, batch_size) do
|
49 |
+
{
|
50 |
+
Nx.Serving,
|
51 |
+
serving: serving, name: name, batch_size: batch_size, batch_timeout: 100
|
52 |
+
}
|
53 |
+
end
|
54 |
end
|