timgremore's picture
wip: feat: Separate transcriptions from liveview
34b4725
raw
history blame
1.99 kB
defmodule MedicalTranscription.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
alias AudioTagger.{KeywordFinder, Transcriber, Vectors}
@model_name "openai/whisper-tiny"
@impl true
def start(_type, _args) do
children = [
MedicalTranscriptionWeb.Telemetry,
MedicalTranscription.Repo,
{DNSCluster,
query: Application.get_env(:medical_transcription, :dns_cluster_query) || :ignore},
{Phoenix.PubSub, name: MedicalTranscription.PubSub},
# Start the Finch HTTP client for sending emails
{Finch, name: MedicalTranscription.Finch},
transcription_spec(),
token_classification_spec(),
text_embedding_spec(),
{
MedicalTranscription.TranscriptionSupervisor,
name: MedicalTranscription.TranscriptionSupervisor,
strategy: :one_for_one
},
# Start a worker by calling: MedicalTranscription.Worker.start_link(arg)
# {MedicalTranscription.Worker, arg},
# Start to serve requests, typically the last entry
MedicalTranscriptionWeb.Endpoint
]
# See https://hexdocs.pm/elixir/Supervisor.html
# for other strategies and supported options
opts = [strategy: :one_for_one, name: MedicalTranscription.Supervisor]
Supervisor.start_link(children, opts)
end
# Tell Phoenix to update the endpoint configuration
# whenever the application is updated.
@impl true
def config_change(changed, _new, removed) do
MedicalTranscriptionWeb.Endpoint.config_change(changed, removed)
:ok
end
defp transcription_spec do
Transcriber.child_spec(MedicalTranscription.TranscriptionServing, @model_name)
end
defp token_classification_spec do
KeywordFinder.token_classification_child_spec(MedicalTranscription.TokenClassificationServing)
end
defp text_embedding_spec do
Vectors.child_spec(MedicalTranscription.TextEmbeddingServing)
end
end