isa-model 0.3.4__py3-none-any.whl → 0.3.6__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/__init__.py +30 -1
- isa_model/client.py +770 -0
- isa_model/core/config/__init__.py +16 -0
- isa_model/core/config/config_manager.py +514 -0
- isa_model/core/config.py +426 -0
- isa_model/core/models/model_billing_tracker.py +476 -0
- isa_model/core/models/model_manager.py +399 -0
- isa_model/core/models/model_repo.py +343 -0
- isa_model/core/pricing_manager.py +426 -0
- isa_model/core/services/__init__.py +19 -0
- isa_model/core/services/intelligent_model_selector.py +547 -0
- isa_model/core/types.py +291 -0
- isa_model/deployment/__init__.py +2 -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 +766 -0
- isa_model/deployment/cloud/modal/isa_vision_table_service.py +532 -0
- isa_model/deployment/cloud/modal/isa_vision_ui_service.py +406 -0
- isa_model/deployment/cloud/modal/register_models.py +321 -0
- isa_model/deployment/runtime/deployed_service.py +338 -0
- isa_model/deployment/services/__init__.py +9 -0
- isa_model/deployment/services/auto_deploy_vision_service.py +537 -0
- isa_model/deployment/services/model_service.py +332 -0
- isa_model/deployment/services/service_monitor.py +356 -0
- isa_model/deployment/services/service_registry.py +527 -0
- isa_model/eval/__init__.py +80 -44
- isa_model/eval/config/__init__.py +10 -0
- isa_model/eval/config/evaluation_config.py +108 -0
- isa_model/eval/evaluators/__init__.py +18 -0
- isa_model/eval/evaluators/base_evaluator.py +503 -0
- isa_model/eval/evaluators/llm_evaluator.py +472 -0
- isa_model/eval/factory.py +417 -709
- isa_model/eval/infrastructure/__init__.py +24 -0
- isa_model/eval/infrastructure/experiment_tracker.py +466 -0
- isa_model/eval/metrics.py +191 -21
- isa_model/inference/ai_factory.py +187 -387
- 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/audio/base_stt_service.py +65 -1
- isa_model/inference/services/audio/base_tts_service.py +75 -1
- isa_model/inference/services/audio/openai_stt_service.py +189 -151
- isa_model/inference/services/audio/openai_tts_service.py +12 -10
- isa_model/inference/services/audio/replicate_tts_service.py +61 -56
- isa_model/inference/services/base_service.py +55 -55
- isa_model/inference/services/embedding/base_embed_service.py +65 -1
- isa_model/inference/services/embedding/ollama_embed_service.py +103 -43
- isa_model/inference/services/embedding/openai_embed_service.py +8 -10
- isa_model/inference/services/helpers/stacked_config.py +148 -0
- isa_model/inference/services/img/__init__.py +18 -0
- isa_model/inference/services/{vision → img}/base_image_gen_service.py +80 -35
- isa_model/inference/services/img/flux_professional_service.py +603 -0
- isa_model/inference/services/img/helpers/base_stacked_service.py +274 -0
- isa_model/inference/services/{vision → img}/replicate_image_gen_service.py +210 -69
- isa_model/inference/services/llm/__init__.py +3 -3
- isa_model/inference/services/llm/base_llm_service.py +519 -35
- isa_model/inference/services/llm/{llm_adapter.py → helpers/llm_adapter.py} +40 -0
- isa_model/inference/services/llm/helpers/llm_prompts.py +258 -0
- isa_model/inference/services/llm/helpers/llm_utils.py +280 -0
- isa_model/inference/services/llm/ollama_llm_service.py +150 -15
- isa_model/inference/services/llm/openai_llm_service.py +134 -31
- isa_model/inference/services/llm/yyds_llm_service.py +255 -0
- isa_model/inference/services/vision/__init__.py +38 -4
- isa_model/inference/services/vision/base_vision_service.py +241 -96
- isa_model/inference/services/vision/disabled/isA_vision_service.py +500 -0
- isa_model/inference/services/vision/doc_analysis_service.py +640 -0
- isa_model/inference/services/vision/helpers/base_stacked_service.py +274 -0
- isa_model/inference/services/vision/helpers/image_utils.py +272 -3
- isa_model/inference/services/vision/helpers/vision_prompts.py +297 -0
- isa_model/inference/services/vision/openai_vision_service.py +109 -170
- isa_model/inference/services/vision/replicate_vision_service.py +508 -0
- isa_model/inference/services/vision/ui_analysis_service.py +823 -0
- isa_model/scripts/register_models.py +370 -0
- isa_model/scripts/register_models_with_embeddings.py +510 -0
- isa_model/serving/__init__.py +19 -0
- isa_model/serving/api/__init__.py +10 -0
- isa_model/serving/api/fastapi_server.py +89 -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/unified.py +202 -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.6.dist-info}/METADATA +4 -1
- isa_model-0.3.6.dist-info/RECORD +147 -0
- isa_model/core/model_manager.py +0 -208
- isa_model/core/model_registry.py +0 -342
- isa_model/inference/billing_tracker.py +0 -406
- isa_model/inference/services/llm/triton_llm_service.py +0 -481
- isa_model/inference/services/vision/ollama_vision_service.py +0 -194
- isa_model-0.3.4.dist-info/RECORD +0 -91
- /isa_model/core/{model_storage.py → models/model_storage.py} +0 -0
- /isa_model/inference/services/{vision → embedding}/helpers/text_splitter.py +0 -0
- {isa_model-0.3.4.dist-info → isa_model-0.3.6.dist-info}/WHEEL +0 -0
- {isa_model-0.3.4.dist-info → isa_model-0.3.6.dist-info}/top_level.txt +0 -0
@@ -3,7 +3,86 @@ from typing import Dict, Any, List, Union, Optional, BinaryIO
|
|
3
3
|
from isa_model.inference.services.base_service import BaseService
|
4
4
|
|
5
5
|
class BaseImageGenService(BaseService):
|
6
|
-
"""Base class for image generation services"""
|
6
|
+
"""Base class for image generation services with unified task dispatch"""
|
7
|
+
|
8
|
+
async def invoke(
|
9
|
+
self,
|
10
|
+
prompt: str,
|
11
|
+
task: Optional[str] = None,
|
12
|
+
**kwargs
|
13
|
+
) -> Union[Dict[str, Any], List[Dict[str, Any]]]:
|
14
|
+
"""
|
15
|
+
统一的任务分发方法 - Base类提供通用实现
|
16
|
+
|
17
|
+
Args:
|
18
|
+
prompt: 文本提示词
|
19
|
+
task: 任务类型,支持多种图像生成任务
|
20
|
+
**kwargs: 任务特定的附加参数
|
21
|
+
|
22
|
+
Returns:
|
23
|
+
Dict or List[Dict] containing generation results
|
24
|
+
"""
|
25
|
+
task = task or "generate"
|
26
|
+
|
27
|
+
# ==================== 图像生成类任务 ====================
|
28
|
+
if task == "generate":
|
29
|
+
num_images = kwargs.get("num_images", 1)
|
30
|
+
if num_images == 1:
|
31
|
+
return await self.generate_image(
|
32
|
+
prompt,
|
33
|
+
kwargs.get("negative_prompt"),
|
34
|
+
kwargs.get("width", 512),
|
35
|
+
kwargs.get("height", 512),
|
36
|
+
kwargs.get("num_inference_steps", 20),
|
37
|
+
kwargs.get("guidance_scale", 7.5),
|
38
|
+
kwargs.get("seed")
|
39
|
+
)
|
40
|
+
else:
|
41
|
+
return await self.generate_images(
|
42
|
+
prompt,
|
43
|
+
num_images,
|
44
|
+
kwargs.get("negative_prompt"),
|
45
|
+
kwargs.get("width", 512),
|
46
|
+
kwargs.get("height", 512),
|
47
|
+
kwargs.get("num_inference_steps", 20),
|
48
|
+
kwargs.get("guidance_scale", 7.5),
|
49
|
+
kwargs.get("seed")
|
50
|
+
)
|
51
|
+
elif task == "generate_batch":
|
52
|
+
return await self.generate_images(
|
53
|
+
prompt,
|
54
|
+
kwargs.get("num_images", 4),
|
55
|
+
kwargs.get("negative_prompt"),
|
56
|
+
kwargs.get("width", 512),
|
57
|
+
kwargs.get("height", 512),
|
58
|
+
kwargs.get("num_inference_steps", 20),
|
59
|
+
kwargs.get("guidance_scale", 7.5),
|
60
|
+
kwargs.get("seed")
|
61
|
+
)
|
62
|
+
elif task == "img2img":
|
63
|
+
init_image = kwargs.get("init_image")
|
64
|
+
if not init_image:
|
65
|
+
raise ValueError("img2img task requires init_image parameter")
|
66
|
+
return await self.image_to_image(
|
67
|
+
prompt,
|
68
|
+
init_image,
|
69
|
+
kwargs.get("strength", 0.8),
|
70
|
+
kwargs.get("negative_prompt"),
|
71
|
+
kwargs.get("num_inference_steps", 20),
|
72
|
+
kwargs.get("guidance_scale", 7.5),
|
73
|
+
kwargs.get("seed")
|
74
|
+
)
|
75
|
+
else:
|
76
|
+
raise NotImplementedError(f"{self.__class__.__name__} does not support task: {task}")
|
77
|
+
|
78
|
+
def get_supported_tasks(self) -> List[str]:
|
79
|
+
"""
|
80
|
+
获取支持的任务列表
|
81
|
+
|
82
|
+
Returns:
|
83
|
+
List of supported task names
|
84
|
+
"""
|
85
|
+
return ["generate", "generate_batch", "img2img"]
|
7
86
|
|
8
87
|
@abstractmethod
|
9
88
|
async def generate_image(
|
@@ -68,40 +147,6 @@ class BaseImageGenService(BaseService):
|
|
68
147
|
"""
|
69
148
|
pass
|
70
149
|
|
71
|
-
@abstractmethod
|
72
|
-
async def generate_image_to_file(
|
73
|
-
self,
|
74
|
-
prompt: str,
|
75
|
-
output_path: str,
|
76
|
-
negative_prompt: Optional[str] = None,
|
77
|
-
width: int = 512,
|
78
|
-
height: int = 512,
|
79
|
-
num_inference_steps: int = 20,
|
80
|
-
guidance_scale: float = 7.5,
|
81
|
-
seed: Optional[int] = None
|
82
|
-
) -> Dict[str, Any]:
|
83
|
-
"""
|
84
|
-
Generate image and save directly to file
|
85
|
-
|
86
|
-
Args:
|
87
|
-
prompt: Text description of the desired image
|
88
|
-
output_path: Path to save the generated image
|
89
|
-
negative_prompt: Text describing what to avoid in the image
|
90
|
-
width: Image width in pixels
|
91
|
-
height: Image height in pixels
|
92
|
-
num_inference_steps: Number of denoising steps
|
93
|
-
guidance_scale: How closely to follow the prompt
|
94
|
-
seed: Random seed for reproducible results
|
95
|
-
|
96
|
-
Returns:
|
97
|
-
Dict containing generation results with keys:
|
98
|
-
- file_path: Path to saved image
|
99
|
-
- width: Image width
|
100
|
-
- height: Image height
|
101
|
-
- seed: Seed used for generation
|
102
|
-
"""
|
103
|
-
pass
|
104
|
-
|
105
150
|
@abstractmethod
|
106
151
|
async def image_to_image(
|
107
152
|
self,
|