Spaces:
Running
on
Zero
Running
on
Zero
fix: π re-add @GPU decorator to detection functions
Browse files
app.py
CHANGED
|
@@ -154,7 +154,7 @@ def create_annotated_image_normalized(image, json_data, label="object"):
|
|
| 154 |
|
| 155 |
return Image.fromarray(annotated_image)
|
| 156 |
|
| 157 |
-
|
| 158 |
def detect_qwen(image, prompt):
|
| 159 |
messages = [
|
| 160 |
{
|
|
@@ -203,7 +203,7 @@ def detect_qwen(image, prompt):
|
|
| 203 |
return annotated_image, output_text, time_taken
|
| 204 |
|
| 205 |
|
| 206 |
-
|
| 207 |
def detect_moondream(image, prompt, category_input):
|
| 208 |
t0 = time.perf_counter()
|
| 209 |
if category_input in ["Object Detection", "Visual Grounding + Object Detection"]:
|
|
@@ -223,7 +223,7 @@ def detect_moondream(image, prompt, category_input):
|
|
| 223 |
time_taken = f"**Inference time ({model_moondream_name}):** {elapsed_ms:.0f} ms"
|
| 224 |
return annotated_image, output_text, time_taken
|
| 225 |
|
| 226 |
-
|
| 227 |
def detect(image, prompt_model_1, prompt_model_2, category_input):
|
| 228 |
STANDARD_SIZE = (1024, 1024)
|
| 229 |
image.thumbnail(STANDARD_SIZE)
|
|
|
|
| 154 |
|
| 155 |
return Image.fromarray(annotated_image)
|
| 156 |
|
| 157 |
+
@GPU
|
| 158 |
def detect_qwen(image, prompt):
|
| 159 |
messages = [
|
| 160 |
{
|
|
|
|
| 203 |
return annotated_image, output_text, time_taken
|
| 204 |
|
| 205 |
|
| 206 |
+
@GPU
|
| 207 |
def detect_moondream(image, prompt, category_input):
|
| 208 |
t0 = time.perf_counter()
|
| 209 |
if category_input in ["Object Detection", "Visual Grounding + Object Detection"]:
|
|
|
|
| 223 |
time_taken = f"**Inference time ({model_moondream_name}):** {elapsed_ms:.0f} ms"
|
| 224 |
return annotated_image, output_text, time_taken
|
| 225 |
|
| 226 |
+
|
| 227 |
def detect(image, prompt_model_1, prompt_model_2, category_input):
|
| 228 |
STANDARD_SIZE = (1024, 1024)
|
| 229 |
image.thumbnail(STANDARD_SIZE)
|