Skip to content

Commit

Permalink
Update lib/kino_bumblebee/task_cell.ex
Browse files Browse the repository at this point in the history
Co-authored-by: José Valim <jose.valim@gmail.com>
  • Loading branch information
jonatanklosko and josevalim authored Sep 14, 2023
1 parent 975c75f commit f71c9e6
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions lib/kino_bumblebee/task_cell.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1321,21 +1321,10 @@ defmodule KinoBumblebee.TaskCell do
for chunk <- Nx.Serving.run(serving, audio) do
[start_mark, end_mark] =
for seconds <- [chunk.start_timestamp_seconds, chunk.end_timestamp_seconds] do
seconds = round(seconds)

minutes =
seconds
|> div(60)
|> Integer.to_string()
|> String.pad_leading(2, "0")

seconds =
seconds
|> rem(60)
|> Integer.to_string()
|> String.pad_leading(2, "0")

minutes <> ":" <> seconds
seconds
|> round()
|> Time.from_seconds_after_midnight()
|> Time.to_string()
end

text = "#{start_mark}-#{end_mark}: #{chunk.text}"
Expand Down

0 comments on commit f71c9e6

Please sign in to comment.