|
defmodule Medicode.Application do |
|
|
|
|
|
@moduledoc false |
|
|
|
use Application |
|
alias AudioTagger.{KeywordFinder, Transcriber, Vectors} |
|
|
|
@model_name "openai/whisper-tiny" |
|
|
|
@impl true |
|
def start(_type, _args) do |
|
children = [ |
|
MedicodeWeb.Telemetry, |
|
Medicode.Repo, |
|
{DNSCluster, |
|
query: Application.get_env(:medicode, :dns_cluster_query) || :ignore}, |
|
{Phoenix.PubSub, name: :medicode_pubsub}, |
|
|
|
{Finch, name: Medicode.Finch}, |
|
transcription_spec(), |
|
token_classification_spec(), |
|
text_embedding_spec(), |
|
{Registry, keys: :unique, name: :transcription_registry}, |
|
{ |
|
Medicode.TranscriptionSupervisor, |
|
strategy: :one_for_one, max_restarts: 1 |
|
}, |
|
{ |
|
Medicode.ClassificationSupervisor, |
|
strategy: :one_for_one, max_restarts: 1 |
|
}, |
|
|
|
|
|
|
|
MedicodeWeb.Endpoint |
|
] |
|
|
|
|
|
|
|
opts = [strategy: :one_for_one, name: Medicode.Supervisor] |
|
Supervisor.start_link(children, opts) |
|
end |
|
|
|
|
|
|
|
@impl true |
|
def config_change(changed, _new, removed) do |
|
MedicodeWeb.Endpoint.config_change(changed, removed) |
|
:ok |
|
end |
|
|
|
defp transcription_spec do |
|
Transcriber.child_spec(Medicode.TranscriptionServing, @model_name) |
|
end |
|
|
|
defp token_classification_spec do |
|
KeywordFinder.token_classification_child_spec(Medicode.TokenClassificationServing) |
|
end |
|
|
|
defp text_embedding_spec do |
|
Vectors.child_spec(Medicode.TextEmbeddingServing) |
|
end |
|
end |
|
|