1

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.

Idiaye
  • 39
  • 8

1 Answers1

0

Have you declare all the dependency in the requirements.txt file. For reference have a look at this space created by me: https://huggingface.co/spaces/abhibisht89/ADR_XTRACTER/tree/main

Hope this will be helpful .

Abhishek Bisht
  • 138
  • 1
  • 10