Update app.py
Browse files
app.py
CHANGED
@@ -1,6 +1,6 @@
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
-
from transformers import
|
4 |
from PIL import Image
|
5 |
import numpy as np
|
6 |
import logging
|
@@ -9,10 +9,10 @@ import logging
|
|
9 |
logging.basicConfig(level=logging.DEBUG)
|
10 |
|
11 |
# Load the pre-trained model and feature extractor
|
12 |
-
model_name = "
|
13 |
logging.info("Loading image processor and model...")
|
14 |
-
feature_extractor =
|
15 |
-
model =
|
16 |
|
17 |
# Define the prediction function
|
18 |
def predict(image):
|
|
|
1 |
import gradio as gr
|
2 |
import torch
|
3 |
+
from transformers import DetrImageProcessor, DetrForObjectDetection
|
4 |
from PIL import Image
|
5 |
import numpy as np
|
6 |
import logging
|
|
|
9 |
logging.basicConfig(level=logging.DEBUG)
|
10 |
|
11 |
# Load the pre-trained model and feature extractor
|
12 |
+
model_name = "IDEA-Research/grounding-dino-tiny"
|
13 |
logging.info("Loading image processor and model...")
|
14 |
+
feature_extractor = DetrImageProcessor.from_pretrained(model_name)
|
15 |
+
model = DetrForObjectDetection.from_pretrained(model_name)
|
16 |
|
17 |
# Define the prediction function
|
18 |
def predict(image):
|