Skip to content

Commit

Permalink
fix: Remove warning of pattern matching when consuming files.
Browse files Browse the repository at this point in the history
  • Loading branch information
LuchoTurtle committed Nov 7, 2023
1 parent 098ae7f commit 046b81a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -1137,12 +1137,12 @@ change the `handle_progress/3` function to the following.
if entry.done? do

# Consume the entry and get the tensor to feed to classifier
{:ok, tensor, file_binary} = consume_uploaded_entry(socket, entry, fn %{} = meta ->
%{tensor: tensor, file_binary: file_binary} = consume_uploaded_entry(socket, entry, fn %{} = meta ->
file_binary = File.read!(meta.path)

{:ok, vimage} = Vix.Vips.Image.new_from_file(meta.path)
{:ok, tensor} = pre_process_image(vimage)
{:ok, tensor, file_binary}
{:ok, %{tensor: tensor, file_binary: file_binary}}
end)

# Create an async task to classify the image
Expand Down
4 changes: 2 additions & 2 deletions lib/app_web/live/page_live.ex
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,12 @@ defmodule AppWeb.PageLive do
if entry.done? do

# Consume the entry and get the tensor to feed to classifier
{:ok, tensor, file_binary} = consume_uploaded_entry(socket, entry, fn %{} = meta ->
%{tensor: tensor, file_binary: file_binary} = consume_uploaded_entry(socket, entry, fn %{} = meta ->
file_binary = File.read!(meta.path)

{:ok, vimage} = Vix.Vips.Image.new_from_file(meta.path)
{:ok, tensor} = pre_process_image(vimage)
{:ok, tensor, file_binary}
{:ok, %{tensor: tensor, file_binary: file_binary}}
end)

# Create an async task to classify the image
Expand Down

0 comments on commit 046b81a

Please sign in to comment.