Spaces:
Running
Running
Create model.py
Browse files
model.py
ADDED
@@ -0,0 +1,8 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1 |
+
# Load model directly
|
2 |
+
import os
|
3 |
+
from dotenv import load_dotenv
|
4 |
+
load_dotenv()
|
5 |
+
model_name = os.getenv('MODEL_NAME') # model name for huggingface.co in .env file
|
6 |
+
from transformers import AutoImageProcessor, AutoModelForObjectDetection
|
7 |
+
processor = AutoImageProcessor.from_pretrained(model_name)
|
8 |
+
model = AutoModelForObjectDetection.from_pretrained(model_name)
|