Collectives™ on Stack Overflow
Find centralized, trusted content and collaborate around the technologies you use most.
Learn more about Collectives
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Learn more about Teams
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.
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 .
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.