Spaces:
Sleeping
Sleeping
noahsettersten
commited on
Commit
•
5cd1e90
1
Parent(s):
4b222d3
docs: Update notes in `tag_from_library.livemd`
Browse files
public-apps/tag_from_library.livemd
CHANGED
@@ -5,9 +5,7 @@
|
|
5 |
```elixir
|
6 |
Mix.install(
|
7 |
[
|
8 |
-
# {:audio_tagger, git: "git@github.com:headwayio/audio_tagger.git"},
|
9 |
{:audio_tagger, git: "https://github.com/headwayio/audio_tagger.git"},
|
10 |
-
# {:audio_tagger, path: "/Users/noah/development/audio_tagger"},
|
11 |
{:kino_bumblebee, "~> 0.4.0"},
|
12 |
{:exla, ">= 0.0.0"},
|
13 |
{:explorer, "~> 0.7.0"},
|
@@ -26,7 +24,7 @@ audio_input = Kino.Input.audio("Audio", sampling_rate: featurizer.sampling_rate)
|
|
26 |
```
|
27 |
|
28 |
```elixir
|
29 |
-
# 2 - Transcribe audio recording to text
|
30 |
# Takes 5–6s for about a minute of audio
|
31 |
chosen_audio = Kino.Input.read(audio_input)
|
32 |
file = chosen_audio.file_ref |> Kino.Input.file_path() |> File.read!()
|
@@ -41,11 +39,13 @@ transcription_df |> Explorer.DataFrame.head(3)
|
|
41 |
## Step 2: Tag Transcribed Audio
|
42 |
|
43 |
```elixir
|
44 |
-
# Now
|
45 |
-
# text-classification
|
46 |
-
# code list).
|
47 |
|
48 |
-
#
|
|
|
|
|
49 |
|
50 |
labels_df = AudioTagger.SampleData.icd10_codes()
|
51 |
tagged_audio = AudioTagger.Tagger.tag_audio(transcription_df, labels_df)
|
|
|
5 |
```elixir
|
6 |
Mix.install(
|
7 |
[
|
|
|
8 |
{:audio_tagger, git: "https://github.com/headwayio/audio_tagger.git"},
|
|
|
9 |
{:kino_bumblebee, "~> 0.4.0"},
|
10 |
{:exla, ">= 0.0.0"},
|
11 |
{:explorer, "~> 0.7.0"},
|
|
|
24 |
```
|
25 |
|
26 |
```elixir
|
27 |
+
# 2 - Transcribe audio recording to text (using openai/whisper-tiny)
|
28 |
# Takes 5–6s for about a minute of audio
|
29 |
chosen_audio = Kino.Input.read(audio_input)
|
30 |
file = chosen_audio.file_ref |> Kino.Input.file_path() |> File.read!()
|
|
|
39 |
## Step 2: Tag Transcribed Audio
|
40 |
|
41 |
```elixir
|
42 |
+
# Now, we run the portions of the transcribed text through the facebook/bart-large-mnli model
|
43 |
+
# and do zero-shot text-classification to attempt to tag each with a procedure code
|
44 |
+
# (based on the ICD-10 code list).
|
45 |
|
46 |
+
# The number of labels provided to the model has a direct impact on performance:
|
47 |
+
# - 14 text entries with 1,000 labels takes a considerable time: 1793.8s total ~= 29+m
|
48 |
+
# - 14 text entries with 10 labels produces much quicker results: 31.8s total
|
49 |
|
50 |
labels_df = AudioTagger.SampleData.icd10_codes()
|
51 |
tagged_audio = AudioTagger.Tagger.tag_audio(transcription_df, labels_df)
|