Spaces:
Runtime error
Runtime error
Update app.py
Browse files
app.py
CHANGED
@@ -14,6 +14,7 @@ model_mm_grounding_id = "rziga/mm_grounding_dino_tiny_o365v1_goldg"
|
|
14 |
model_llmdet_name = extract_model_short_name(model_llmdet_id)
|
15 |
model_mm_grounding_name = extract_model_short_name(model_mm_grounding_id)
|
16 |
|
|
|
17 |
def detect_llmdet(image: Image.Image, prompts: list, threshold: float):
|
18 |
t0 = time.perf_counter()
|
19 |
model_id = model_llmdet_id
|
@@ -42,6 +43,7 @@ def detect_llmdet(image: Image.Image, prompts: list, threshold: float):
|
|
42 |
raw_text = "\n".join(raw_results) if raw_results else "No detections"
|
43 |
return annotations, raw_text, time_taken
|
44 |
|
|
|
45 |
def detect_mm_grounding(image: Image.Image, prompts: list, threshold: float):
|
46 |
t0 = time.perf_counter()
|
47 |
model_id = model_mm_grounding_id
|
@@ -70,7 +72,7 @@ def detect_mm_grounding(image: Image.Image, prompts: list, threshold: float):
|
|
70 |
raw_text = "\n".join(raw_results) if raw_results else "No detections"
|
71 |
return annotations, raw_text, time_taken
|
72 |
|
73 |
-
|
74 |
def run_detection(image, prompts_str, threshold):
|
75 |
if image is None:
|
76 |
return (None, []), "No detections", "", (None, []), "No detections", ""
|
|
|
14 |
model_llmdet_name = extract_model_short_name(model_llmdet_id)
|
15 |
model_mm_grounding_name = extract_model_short_name(model_mm_grounding_id)
|
16 |
|
17 |
+
@spaces.GPU
|
18 |
def detect_llmdet(image: Image.Image, prompts: list, threshold: float):
|
19 |
t0 = time.perf_counter()
|
20 |
model_id = model_llmdet_id
|
|
|
43 |
raw_text = "\n".join(raw_results) if raw_results else "No detections"
|
44 |
return annotations, raw_text, time_taken
|
45 |
|
46 |
+
@spaces.GPU
|
47 |
def detect_mm_grounding(image: Image.Image, prompts: list, threshold: float):
|
48 |
t0 = time.perf_counter()
|
49 |
model_id = model_mm_grounding_id
|
|
|
72 |
raw_text = "\n".join(raw_results) if raw_results else "No detections"
|
73 |
return annotations, raw_text, time_taken
|
74 |
|
75 |
+
|
76 |
def run_detection(image, prompts_str, threshold):
|
77 |
if image is None:
|
78 |
return (None, []), "No detections", "", (None, []), "No detections", ""
|