Lesson 2 official topic

change few lines of code from search_images_bing to search_images_ddg and remove the key* and rest should be the same :slight_smile:

This looks great :slight_smile: but i am confused regarding how to add the model.pkl into app.py and code(customize) it out

After many trial and errors i finally uploaded a working code to gradio in hugging face :smiley:

Here is a simple model to check if person is happy or sad .
I download the data.
I run the model on data (after removing failed links ).
I cleaned the data as taught in lesson 2.
I trained the model with cleaned data.
Exported into .pkl and uploaded it to gradio ( after a lot of effort and errors )

2 Likes

working Teddy/grizzly/black bear classifier here:

https://www.kaggle.com/code/xiu0504/from-model-to-production/

on my mac machine, I setup the env using conda and vscode

brew install git-lfs
conda init zsh
conda install fastai gradio scikit-image
1 Like

I am sorry. I have just seen this message.

Nice one

Hi everyone, hoping someone can help me with this. I’m following along this lesson on YouTube and in the book and have gotten to the section where we are exploring the different Resize methods. I can get the the Resize transformation methods to work, but can’t seem to get the RandomResizedCrop to work. The images are not being resized or cropped.

I’ve tried multiple things, like re-creating the Datablock, and downloading other images… but can’t seem to get it working. Here is my code:

bears = DataBlock(
    blocks=(ImageBlock, CategoryBlock),
    get_items=get_image_files,
    splitter=RandomSplitter(valid_pct=0.2, seed=42),
    get_y=parent_label,
    item_tfms=Resize(128)
)

bears = bears.new(item_tfms=RandomResizedCrop(256)) 
dls = bears.dataloaders(path)
dls.valid.show_batch(max_n=4, nrows=1, unique=True)

I have gotten it to work when I run it on one image though…

grizzly_bear = PILImage.create('grizzly_bear.jpg')

crop = RandomResizedCrop(256, min_scale=0.05, max_scale=0.15)
_,axs = plt.subplots(3,3,figsize=(9,9))
for ax in axs.flatten():
    cropped = crop(grizzly_bear)
    show_image(cropped, ctx=ax);

Has anyone facied this issue before? Thank you in advance.

Hi,
I think the issue is that you are trying to show a batch from the validation set, where we do not perform data augmentation (RandomResizedCrop).
So, instead of

dls.valid.show_batch(max_n=4, nrows=1, unique=True)

you will see the differences when showing a batch from the training set, i.e.

dls.train.show_batch(max_n=4, nrows=1, unique=True)

Hope that helps!

1 Like

This worked. Thank you :pray:

Hi I was working through the video tutorial to create my own web application, I am at the stage where I create the app.py file for the HuggingFace space

After that when I clicked the tick in vscode that would allow me to push, then I got a notification saying that there are no standing changes to commit or something like that, I proceeded anyway and refreshed my hugging face page but the basic application did not show up

can I get some help, Thank you

Hi guys I was also trying to get fastai and python setup and having the following problem where mamba is unavailable and i don’t know why, I even attempted restarting the terminal can I please get some help, i am very new to this

Hello everyone!

Just got a question about using other fastai datasets.

I’m trying to replicate the pet classifier with the flowers dataset. And making it into a hugging face space.

However I’m getting errors when using the pkl model on the site. Am I jumping to far head in the course?

So far I’m just finishing lesson 3.

Can anyone help with setting up huggingface key? That’s the last step i’m missing before uploading the image detector code on huggingface. I’ve already tried following their instructions on their website… going to move onto lesson 3 first, thanks all!

Hello Everybody!

I’m trying to replicate the bear classifier. However, the widget from ImageClassifierCleaner is not working as it should. It’s just loading the image but it hasn’t given me the option to change category or delete the image.

For more Information, this code worked as expected when I ran it the first time. I’ve started getting this issue after I rerun the code. I’ve tried cleaning browser cache and running it again, but it didn’t work. Also I am using brave browser.


Hello everyone!

In the end of the book there should be some link to the blogging manual. But I see it like this.

We've provided full details on how to set up a blog in <>.

Couldn’t find the link on the forums neither.
Where is the best place to start a blog if I want it to be seen by russians and americans fist of all?

The currently fastai-recommended blogging platform is Quarto. You can set it up similar to fastpages (which is no longer maintained but was referenced in previous courses) and use markdown files and jupyter notebooks to publish blog posts.

2 Likes

I am able to deploy my app on huggingface… there seems to be an update in gradio as gr.inputs() and gr.outputs() are not deprecated. so we need to update them in our app.py.

Bearclassifer - a Hugging Face Space by sanketgupta07

Thank you. This was the problem.

Hi! I was watching the lesson recording, and I am wondering where I can access the notebook shown at 41:30, or if there is something else I can do instead. I am confused, because the notebook seems kind of crucial for the lesson, however there is no indication of where the notebook was from, or how others can access it. Maybe I have missed something?

That notebook is in Jeremy’s HuggingFace Space titled “Dog or Cat?”: app.ipynb · jph00/testing at main

1 Like