Spaces:
Sleeping
Sleeping
| from __future__ import annotations | |
| from pydantic import BaseModel, Field | |
| class PredictRequest(BaseModel): | |
| sentence: str = Field(..., min_length=1) | |
| target_word: str = Field(..., min_length=1) | |
| class PredictResponse(BaseModel): | |
| complexity_level: str | |
| level_id: int | |
| level_probs: dict[str, float] | |
| difficult_class_prob: float | |
| reason: str | None | |
| reason_id: int | None | |
| reason_probs: dict[str, float] | None | |
| latency_ms: float | |
| target_in_sentence: bool | |
| class InterveneRequest(BaseModel): | |
| sentence: str | |
| target_word: str | |
| reason: str | |
| use_llm: bool = False | |
| class InterventionDetail(BaseModel): | |
| reason: str | |
| original_sentence: str | |
| edited_sentence: str | |
| edit_method: str | |
| before_level: str | |
| after_level: str | |
| hardness_drop: float | |
| matches_predicted: bool | None = None | |
| class InterveneResponse(BaseModel): | |
| intervention: InterventionDetail | |
| class InterveneAllRequest(BaseModel): | |
| sentence: str | |
| target_word: str | |
| predicted_reason: str | None = None | |
| use_llm: bool = False | |
| class InterveneAllResponse(BaseModel): | |
| base_level: str | |
| results: list[InterventionDetail] | |
| best_reason: str | |
| faithful: bool | None | |
| class EfficiencyRequest(BaseModel): | |
| sentence: str | |
| target_word: str | |
| local_latency_ms: float = Field(..., ge=0) | |
| class EfficiencyResponse(BaseModel): | |
| local_latency_ms: float | |
| ai_latency_ms: float | |
| ai_provider: str | |
| ai_cost_usd: float | |
| ai_cost_per_1k_usd: float | |
| local_cost_usd: float | |
| speedup_factor: float | |
| class HealthResponse(BaseModel): | |
| status: str | |
| model_path: str | |
| model_ready: bool | |
| model_error: str | None = None | |
| class AlterComplexityRequest(BaseModel): | |
| sentence: str = Field(..., min_length=1) | |
| target_word: str = Field(..., min_length=1) | |
| reason: str = Field(..., min_length=1) | |
| direction: str = Field(..., pattern="^(increase|decrease)$") | |
| class AlterComplexityResponse(BaseModel): | |
| reason: str | |
| direction: str | |
| original_sentence: str | |
| original_target_word: str | |
| new_sentence: str | |
| new_target_word: str | |
| edit_method: str | |
| explanation: str | |
| updates: str | |