pratikshahp's picture
Create model.py
1319515 verified
raw
history blame
354 Bytes
# Load model directly
import os
from dotenv import load_dotenv
load_dotenv()
model_name = os.getenv('MODEL_NAME') # model name for huggingface.co in .env file
from transformers import AutoImageProcessor, AutoModelForObjectDetection
processor = AutoImageProcessor.from_pretrained(model_name)
model = AutoModelForObjectDetection.from_pretrained(model_name)