chore: mark vision analysis for gpu execution
Browse files
app.py
CHANGED
|
@@ -4,6 +4,7 @@ from typing import Any, Dict, List, Optional
|
|
| 4 |
|
| 5 |
import gradio as gr
|
| 6 |
import torch
|
|
|
|
| 7 |
from PIL import Image, ImageDraw
|
| 8 |
from transformers import AutoModelForVision2Seq, AutoProcessor
|
| 9 |
|
|
@@ -121,6 +122,7 @@ def _parse_vl_response(text: str) -> Dict[str, Any]:
|
|
| 121 |
}
|
| 122 |
|
| 123 |
|
|
|
|
| 124 |
def analyze_image_with_qwen(image: Image.Image) -> Dict[str, Any]:
|
| 125 |
instructions = (
|
| 126 |
"μ¬μ§ μ μ½λ΄ν¬/μ²λ°©μ μ μ½κ³ μλ JSON νμμΌλ‘λ§ λ΅λ³νμΈμ. "
|
|
|
|
| 4 |
|
| 5 |
import gradio as gr
|
| 6 |
import torch
|
| 7 |
+
import spaces
|
| 8 |
from PIL import Image, ImageDraw
|
| 9 |
from transformers import AutoModelForVision2Seq, AutoProcessor
|
| 10 |
|
|
|
|
| 122 |
}
|
| 123 |
|
| 124 |
|
| 125 |
+
@spaces.GPU(enable_queue=True)
|
| 126 |
def analyze_image_with_qwen(image: Image.Image) -> Dict[str, Any]:
|
| 127 |
instructions = (
|
| 128 |
"μ¬μ§ μ μ½λ΄ν¬/μ²λ°©μ μ μ½κ³ μλ JSON νμμΌλ‘λ§ λ΅λ³νμΈμ. "
|