I want to deploy an image classifying transformer model with Gradio to my Hugginface space. I have created a new repository and have created the app.py
file in the browser as per the tutorial on the Gradio website. Below is my deploy code:
from transformers import pipeline
import gradio as gr
import timm
def image_classifier(image):
model = pipeline("image-classification")
return model(image)
gr.Interface.from_pipeline(model).launch()
But when I upload the file, I get a runtime error, which says:
Traceback (most recent call last):
File "app.py", line 1, in <module>
from transformers import pipeline
ModuleNotFoundError: No module named 'transformers'
I try to include a pip install transformers
command in the script, but I still get a runtime error. Please, how can I successfully deploy transformer model with Gradio interface on my Huggingface space? As always, I appreciate your help.