Spaces:
Running
on
Zero
Running
on
Zero
Update models.py
Browse files
models.py
CHANGED
|
@@ -3,8 +3,8 @@ Model management for Frame 0 Laboratory for MIA
|
|
| 3 |
BAGEL 7B integration via API calls
|
| 4 |
"""
|
| 5 |
|
|
|
|
| 6 |
import logging
|
| 7 |
-
import tempfile
|
| 8 |
import os
|
| 9 |
from typing import Optional, Dict, Any, Tuple
|
| 10 |
from PIL import Image
|
|
@@ -88,6 +88,7 @@ class BagelAPIAnalyzer(BaseImageAnalyzer):
|
|
| 88 |
except Exception as e:
|
| 89 |
logger.warning(f"Failed to cleanup temp file: {e}")
|
| 90 |
|
|
|
|
| 91 |
def analyze_image(self, image: Image.Image, prompt: str = None) -> Tuple[str, Dict[str, Any]]:
|
| 92 |
"""Analyze image using BAGEL API"""
|
| 93 |
if not self.is_initialized:
|
|
|
|
| 3 |
BAGEL 7B integration via API calls
|
| 4 |
"""
|
| 5 |
|
| 6 |
+
import spaces
|
| 7 |
import logging
|
|
|
|
| 8 |
import os
|
| 9 |
from typing import Optional, Dict, Any, Tuple
|
| 10 |
from PIL import Image
|
|
|
|
| 88 |
except Exception as e:
|
| 89 |
logger.warning(f"Failed to cleanup temp file: {e}")
|
| 90 |
|
| 91 |
+
@spaces.GPU(duration=60)
|
| 92 |
def analyze_image(self, image: Image.Image, prompt: str = None) -> Tuple[str, Dict[str, Any]]:
|
| 93 |
"""Analyze image using BAGEL API"""
|
| 94 |
if not self.is_initialized:
|