DeepForest icon indicating copy to clipboard operation
DeepForest copied to clipboard

Build hugging faces tutorial

Open bw4sz opened this issue 1 year ago • 11 comments

I think its time we have a gradio app on hugging faces. Can we clone this app and edit from there?

https://huggingface.co/spaces/AndresHdzC/pytorch-wildlife

I think this is a 'good first issue', in the sense it won't take much DeepForest knowledge, but it will take some experience with hugging faces.

Steps

  1. Clone https://huggingface.co/spaces/AndresHdzC/pytorch-wildlife/blob/main/app.py
  2. Integrate the getting started tutorial for birds and tree models.
  3. Show screenshots from local gradio app
  4. Get clearance from @ethanwhite for huggingfaces space
  5. Upload and test Connected to model hosting issue #317 and GSOC conversation #628
  • Would we want to use predict_image or predict_tile? No way to know what size of images to upload, we will need some kind of instruction or logic to guess whether we need to cut images into pieces.

bw4sz avatar Mar 25 '24 15:03 bw4sz

Anyone looking for a somewhat more complex issue that is still manageable without a deep understanding of the code base - this is a good one. Enjoy!

ethanwhite avatar Mar 25 '24 22:03 ethanwhite

I have issued a Pull request for this issue. I have completed the first three steps. Can you please elaborate on the 5th step? Also can you please tell me if I have missed out on anything? Thanks!

Om-Doiphode avatar Mar 26 '24 14:03 Om-Doiphode

@Om-Doiphode - can you send me your huggingface username so I can add you to our organization so you can upload this to the right place

ethanwhite avatar Mar 26 '24 15:03 ethanwhite

@bw4sz is there cost associated with this?

ethanwhite avatar Mar 26 '24 15:03 ethanwhite

@Om-Doiphode - can you send me your huggingface username so I can add you to our organization so you can upload this to the right place

Yeah sure. Following is my username: HawkeyeHS (https://huggingface.co/HawkeyeHS)

Om-Doiphode avatar Mar 26 '24 15:03 Om-Doiphode

Hi @ethanwhite, I have accepted the invite to Hugging Face, how can I push the app to the Hugging Face spaces? Should I push it using my API key since in the organization's settings it says that the organization API tokens have been deprecated and to migrate the system to use User Access Tokens?

Om-Doiphode avatar Mar 27 '24 03:03 Om-Doiphode

@Om-Doiphode - I've created a huggingface space for this. It's a git repo and there are instructions on the page for getting linked up to it so that you can push your draft app:

https://huggingface.co/spaces/weecology/deepforest-demo

If you don't have a git history you can just follow the instructions at that link. If you already have a git history for this project that you'd like to keep let me know and I can walk you through how to connect your local repo to huggingface directly instead of following the instructions for cloning.

ethanwhite avatar Mar 27 '24 11:03 ethanwhite

Hi @ethanwhite, thank you for creating the space. I have pushed my draft app on the space, please review it. Thanks!

Om-Doiphode avatar Mar 27 '24 12:03 Om-Doiphode

Looks great to me! Can you add a mention of this to the docs?

@bw4sz - take a look when you get the chance and see what you think

ethanwhite avatar Mar 28 '24 17:03 ethanwhite

Great start!

image
  • Let's increase the default thickness for predict birds, in predict_tile, thickness = 3? The predictions right now are hard to see, they are there if you squint. We might need some logic for the thickness. If the image is less than 1000 pixels, thickness is 1, over 1000 thickness = 2, more than 5000, thickness = 3?
Screenshot 2024-03-28 at 12 02 40 PM
  • we want to format the errors to show users how they can fix any test images. For example, right now it gives 'error'. it should return the error.
Screenshot 2024-03-28 at 12 20 03 PM
  • We should point to this on the landing page. https://github.com/weecology/DeepForest/blob/main/docs/landing.md

bw4sz avatar Mar 28 '24 22:03 bw4sz

Looks great to me! Can you add a mention of this to the docs?

@bw4sz - take a look when you get the chance and see what you think

I have added the link to the app in the docs in the Getting Started and Prebuilt models sections. I have also added error handling for model prediction.

Om-Doiphode avatar Mar 30 '24 07:03 Om-Doiphode