timgremore's picture
feat: Use struct to prepare model
5aee375
raw
history blame
1.66 kB
defmodule MedicalTranscription.Application do
# See https://hexdocs.pm/elixir/Application.html
# for more information on OTP Applications
@moduledoc false
use Application
@model_name "openai/whisper-tiny"
@impl true
def start(_type, _args) do
transcription_serving =
[model_name: @model_name]
|> AudioTagger.Transcriber.prepare_featurizer()
|> AudioTagger.Transcriber.prepare_serving(@model_name)
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},
{
Nx.Serving,
serving: transcription_serving,
name: TranscriptionServing,
batch_size: 4,
batch_timeout: 100
},
# 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
end