isa-model 0.3.4__py3-none-any.whl → 0.3.5__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- isa_model/config/__init__.py +9 -0
- isa_model/config/config_manager.py +213 -0
- isa_model/core/model_manager.py +5 -0
- isa_model/core/model_registry.py +39 -6
- isa_model/core/storage/supabase_storage.py +344 -0
- isa_model/core/vision_models_init.py +116 -0
- isa_model/deployment/cloud/__init__.py +9 -0
- isa_model/deployment/cloud/modal/__init__.py +10 -0
- isa_model/deployment/cloud/modal/isa_vision_doc_service.py +612 -0
- isa_model/deployment/cloud/modal/isa_vision_ui_service.py +305 -0
- isa_model/inference/ai_factory.py +238 -14
- isa_model/inference/providers/modal_provider.py +109 -0
- isa_model/inference/providers/yyds_provider.py +108 -0
- isa_model/inference/services/__init__.py +2 -1
- isa_model/inference/services/base_service.py +0 -38
- isa_model/inference/services/llm/base_llm_service.py +32 -0
- isa_model/inference/services/llm/llm_adapter.py +40 -0
- isa_model/inference/services/llm/ollama_llm_service.py +104 -3
- isa_model/inference/services/llm/openai_llm_service.py +67 -15
- isa_model/inference/services/llm/yyds_llm_service.py +254 -0
- isa_model/inference/services/stacked/__init__.py +26 -0
- isa_model/inference/services/stacked/base_stacked_service.py +269 -0
- isa_model/inference/services/stacked/config.py +426 -0
- isa_model/inference/services/stacked/doc_analysis_service.py +640 -0
- isa_model/inference/services/stacked/flux_professional_service.py +579 -0
- isa_model/inference/services/stacked/ui_analysis_service.py +1319 -0
- isa_model/inference/services/vision/base_image_gen_service.py +0 -34
- isa_model/inference/services/vision/base_vision_service.py +46 -2
- isa_model/inference/services/vision/isA_vision_service.py +402 -0
- isa_model/inference/services/vision/openai_vision_service.py +151 -9
- isa_model/inference/services/vision/replicate_image_gen_service.py +166 -38
- isa_model/inference/services/vision/replicate_vision_service.py +693 -0
- isa_model/serving/__init__.py +19 -0
- isa_model/serving/api/__init__.py +10 -0
- isa_model/serving/api/fastapi_server.py +84 -0
- isa_model/serving/api/middleware/__init__.py +9 -0
- isa_model/serving/api/middleware/request_logger.py +88 -0
- isa_model/serving/api/routes/__init__.py +5 -0
- isa_model/serving/api/routes/health.py +82 -0
- isa_model/serving/api/routes/llm.py +19 -0
- isa_model/serving/api/routes/ui_analysis.py +223 -0
- isa_model/serving/api/routes/vision.py +19 -0
- isa_model/serving/api/schemas/__init__.py +17 -0
- isa_model/serving/api/schemas/common.py +33 -0
- isa_model/serving/api/schemas/ui_analysis.py +78 -0
- {isa_model-0.3.4.dist-info → isa_model-0.3.5.dist-info}/METADATA +1 -1
- {isa_model-0.3.4.dist-info → isa_model-0.3.5.dist-info}/RECORD +49 -17
- {isa_model-0.3.4.dist-info → isa_model-0.3.5.dist-info}/WHEEL +0 -0
- {isa_model-0.3.4.dist-info → isa_model-0.3.5.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,116 @@
|
|
1
|
+
"""
|
2
|
+
Initialize Vision Models in Model Registry
|
3
|
+
|
4
|
+
Simple function to register vision models for UI analysis in Supabase
|
5
|
+
"""
|
6
|
+
|
7
|
+
from .model_registry import ModelRegistry, ModelType, ModelCapability
|
8
|
+
|
9
|
+
def register_vision_models():
|
10
|
+
"""Register vision models for UI analysis pipeline"""
|
11
|
+
|
12
|
+
registry = ModelRegistry() # Auto-detects Supabase from .env
|
13
|
+
|
14
|
+
# Vision models for UI analysis
|
15
|
+
models = [
|
16
|
+
{
|
17
|
+
"model_id": "omniparser-v2.0",
|
18
|
+
"model_type": ModelType.VISION,
|
19
|
+
"capabilities": [ModelCapability.UI_DETECTION, ModelCapability.IMAGE_ANALYSIS],
|
20
|
+
"metadata": {
|
21
|
+
"repo_id": "microsoft/OmniParser-v2.0",
|
22
|
+
"provider": "microsoft",
|
23
|
+
"version": "2.0",
|
24
|
+
"description": "Advanced UI element detection",
|
25
|
+
"gpu_memory_mb": 8192,
|
26
|
+
"modal_service": "isa-vision"
|
27
|
+
}
|
28
|
+
},
|
29
|
+
{
|
30
|
+
"model_id": "table-transformer-detection",
|
31
|
+
"model_type": ModelType.VISION,
|
32
|
+
"capabilities": [ModelCapability.TABLE_DETECTION, ModelCapability.IMAGE_ANALYSIS],
|
33
|
+
"metadata": {
|
34
|
+
"repo_id": "microsoft/table-transformer-detection",
|
35
|
+
"provider": "microsoft",
|
36
|
+
"version": "1.1",
|
37
|
+
"description": "Table detection in documents",
|
38
|
+
"gpu_memory_mb": 4096,
|
39
|
+
"modal_service": "isa-vision"
|
40
|
+
}
|
41
|
+
},
|
42
|
+
{
|
43
|
+
"model_id": "table-transformer-structure",
|
44
|
+
"model_type": ModelType.VISION,
|
45
|
+
"capabilities": [ModelCapability.TABLE_STRUCTURE_RECOGNITION, ModelCapability.IMAGE_ANALYSIS],
|
46
|
+
"metadata": {
|
47
|
+
"repo_id": "microsoft/table-transformer-structure-recognition-v1.1-all",
|
48
|
+
"provider": "microsoft",
|
49
|
+
"version": "1.1",
|
50
|
+
"description": "Table structure recognition",
|
51
|
+
"gpu_memory_mb": 4096,
|
52
|
+
"modal_service": "isa-vision"
|
53
|
+
}
|
54
|
+
},
|
55
|
+
{
|
56
|
+
"model_id": "paddleocr-v3.0",
|
57
|
+
"model_type": ModelType.VISION,
|
58
|
+
"capabilities": [ModelCapability.OCR, ModelCapability.IMAGE_ANALYSIS],
|
59
|
+
"metadata": {
|
60
|
+
"repo_id": "PaddlePaddle/PaddleOCR",
|
61
|
+
"provider": "paddlepaddle",
|
62
|
+
"version": "3.0",
|
63
|
+
"description": "Multilingual OCR",
|
64
|
+
"gpu_memory_mb": 2048,
|
65
|
+
"modal_service": "isa-vision"
|
66
|
+
}
|
67
|
+
}
|
68
|
+
]
|
69
|
+
|
70
|
+
print("🔧 Registering vision models in Supabase...")
|
71
|
+
|
72
|
+
success_count = 0
|
73
|
+
for model in models:
|
74
|
+
success = registry.register_model(
|
75
|
+
model_id=model["model_id"],
|
76
|
+
model_type=model["model_type"],
|
77
|
+
capabilities=model["capabilities"],
|
78
|
+
metadata=model["metadata"]
|
79
|
+
)
|
80
|
+
|
81
|
+
if success:
|
82
|
+
print(f"✅ {model['model_id']}")
|
83
|
+
success_count += 1
|
84
|
+
else:
|
85
|
+
print(f"❌ {model['model_id']}")
|
86
|
+
|
87
|
+
print(f"\n📊 Registered {success_count}/{len(models)} models")
|
88
|
+
return success_count == len(models)
|
89
|
+
|
90
|
+
def get_model_for_capability(capability: ModelCapability) -> str:
|
91
|
+
"""Get best model for a capability"""
|
92
|
+
|
93
|
+
registry = ModelRegistry()
|
94
|
+
models = registry.get_models_by_capability(capability)
|
95
|
+
|
96
|
+
# Priority mapping
|
97
|
+
priorities = {
|
98
|
+
ModelCapability.UI_DETECTION: ["omniparser-v2.0"],
|
99
|
+
ModelCapability.OCR: ["paddleocr-v3.0"],
|
100
|
+
ModelCapability.TABLE_DETECTION: ["table-transformer-detection"],
|
101
|
+
ModelCapability.TABLE_STRUCTURE_RECOGNITION: ["table-transformer-structure"]
|
102
|
+
}
|
103
|
+
|
104
|
+
preferred = priorities.get(capability, [])
|
105
|
+
for model_id in preferred:
|
106
|
+
if model_id in models:
|
107
|
+
return model_id
|
108
|
+
|
109
|
+
return list(models.keys())[0] if models else None
|
110
|
+
|
111
|
+
if __name__ == "__main__":
|
112
|
+
success = register_vision_models()
|
113
|
+
if success:
|
114
|
+
print("🎉 All vision models registered successfully!")
|
115
|
+
else:
|
116
|
+
print("⚠️ Some models failed to register")
|
@@ -0,0 +1,10 @@
|
|
1
|
+
"""
|
2
|
+
Modal Deployment Module
|
3
|
+
|
4
|
+
Modal.com cloud deployment for ISA Model services
|
5
|
+
"""
|
6
|
+
|
7
|
+
from .ui_analysis_service import UIAnalysisService as UIAnalysisModalService
|
8
|
+
from .deployment_manager import ModalDeployment
|
9
|
+
|
10
|
+
__all__ = ["UIAnalysisModalService", "ModalDeployment"]
|