Commit
•
2989367
1
Parent(s):
4a375b0
chore: Remove old /audio live view
Browse files
lib/medical_transcription_web/live/audio_live/index.ex
DELETED
@@ -1,50 +0,0 @@
|
|
1 |
-
defmodule MedicalTranscriptionWeb.AudioLive.Index do
|
2 |
-
use MedicalTranscriptionWeb, :live_view
|
3 |
-
alias Membrane.RCPipeline
|
4 |
-
|
5 |
-
@impl Phoenix.LiveView
|
6 |
-
def mount(_params, _session, socket) do
|
7 |
-
self_pid = self()
|
8 |
-
spec = MedicalTranscription.Audio.RecordingPipeline.spec(self_pid)
|
9 |
-
pipeline = RCPipeline.start_link!()
|
10 |
-
RCPipeline.exec_actions(pipeline, spec: spec)
|
11 |
-
|
12 |
-
socket =
|
13 |
-
socket
|
14 |
-
|> assign(:pipeline, pipeline)
|
15 |
-
|> assign(:transcription, [
|
16 |
-
"Transcribed audio will appear here."
|
17 |
-
])
|
18 |
-
|
19 |
-
{:ok, socket}
|
20 |
-
end
|
21 |
-
|
22 |
-
@impl Phoenix.LiveView
|
23 |
-
def render(assigns) do
|
24 |
-
~H"""
|
25 |
-
<div class="flex flex-col gap-4">
|
26 |
-
<div class="flex items-center gap-2 animate-pulse">
|
27 |
-
<.icon name="hero-speaker-wave" /> Transcribing spoken audio...
|
28 |
-
</div>
|
29 |
-
<div id="transcription_list" class="flex flex-col gap-1">
|
30 |
-
<h2 class="text-lg font-bold">Transcription:</h2>
|
31 |
-
<ul class="ml-4 list-disc">
|
32 |
-
<%= for line <- @transcription do %>
|
33 |
-
<li><%= line %></li>
|
34 |
-
<% end %>
|
35 |
-
</ul>
|
36 |
-
</div>
|
37 |
-
</div>
|
38 |
-
"""
|
39 |
-
end
|
40 |
-
|
41 |
-
@impl Phoenix.LiveView
|
42 |
-
def terminate(_reason, socket) do
|
43 |
-
RCPipeline.terminate(socket.assigns.pipeline)
|
44 |
-
end
|
45 |
-
|
46 |
-
@impl Phoenix.LiveView
|
47 |
-
def handle_info({:received_audio_payload, payload}, socket) do
|
48 |
-
{:noreply, update(socket, :transcription, &(&1 ++ [payload]))}
|
49 |
-
end
|
50 |
-
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lib/medical_transcription_web/router.ex
CHANGED
@@ -18,7 +18,6 @@ defmodule MedicalTranscriptionWeb.Router do
|
|
18 |
pipe_through :browser
|
19 |
|
20 |
live "/", HomeLive.Index
|
21 |
-
live "/audio", AudioLive.Index
|
22 |
end
|
23 |
|
24 |
# Other scopes may use custom stacks.
|
|
|
18 |
pipe_through :browser
|
19 |
|
20 |
live "/", HomeLive.Index
|
|
|
21 |
end
|
22 |
|
23 |
# Other scopes may use custom stacks.
|