Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

update on line no. 34 for resizing the input (new image) #10

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

jainharshit3107
Copy link

As we drag and drop new image with different dimension, if the input image is not resized it will give error "value error" of expected shape and found shape.

As we drag and drop new image with different dimension, if the input image is not resized it will give error "value error" of expected shape and found shape.
@jainharshit3107 jainharshit3107 changed the title update on line no. 34 of resizing the input (new image) update on line no. 34 for resizing the input (new image) Nov 13, 2021
@@ -31,7 +31,7 @@ async def ping():
return "Hello, I am alive"

def read_file_as_image(data) -> np.ndarray:
image = np.array(Image.open(BytesIO(data)))
image = np.array(Image.open(BytesIO(data)).resize(256, 256))
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image = np.array(Image.open(BytesIO(data)).resize((256,256)))

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IDK why but when I tried, resize worked only with double brackets around 256,256

Copy link

@qaixerabbas qaixerabbas Jan 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.resize() accepts a tuple. Therefore we need to provide double brackets. One for function call and one for the tuple.
Example:
imsize = (256,256)
#now call the function with following
im.resize(imsize) # here imsize already has brackets in previous line. So its good to separate the code for better understanding.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, @jainharshit3107 You have to call resize method the image variable in the main.py file in api folder as @JKS46 showed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants