Upload folder using huggingface_hub
Browse files- Dockerfile +1 -1
- agent_action_tools.py +7 -1
- client.py +7 -1
- inference_debug.py +28 -8
- openenv.yaml +1 -1
- server/__init__.py +1 -2
- server/app.py +3 -8
- server/llm_client.py +2 -1
- server/ppt_agent_environment.py +15 -21
- server/task_registry.py +9 -8
- server/tools/pptx_tools.py +1 -1
- server/utils/pptx_extraction.py +2 -2
- server/utils/presentbench/__init__.py +2 -2
- server/utils/presentbench/metrics.py +2 -2
- server/utils/presentbench/scoring.py +3 -3
- server/utils/presentbench/spec_builder.py +1 -1
- server/utils/rendering/__init__.py +1 -1
- server/utils/rendering/pptx_render_service.py +3 -3
- server/utils/reward_kernel.py +13 -13
- server/utils/reward_metrics.py +1 -1
- server/utils/reward_prompts.py +1 -1
- server/utils/slidesgenbench/__init__.py +5 -5
- server/utils/slidesgenbench/prompts.py +2 -2
- server/utils/slidesgenbench/quantitative_judge.py +3 -3
- server/utils/slidesgenbench/quizbank_service.py +4 -4
- server/utils/slidesgenbench/rendered_aesthetics.py +2 -2
- server/utils/slidesgenbench/scoring.py +6 -6
- server/utils/slidesgenbench/spec_builder.py +2 -2
- server/utils/slidesgenbench/text_layout.py +2 -2
Dockerfile
CHANGED
|
@@ -37,4 +37,4 @@ HEALTHCHECK --interval=30s --timeout=3s --start-period=5s --retries=3 \
|
|
| 37 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 38 |
|
| 39 |
ENV ENABLE_WEB_INTERFACE=true
|
| 40 |
-
CMD ["uvicorn", "server.app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "info"]
|
|
|
|
| 37 |
CMD curl -f http://localhost:7860/health || exit 1
|
| 38 |
|
| 39 |
ENV ENABLE_WEB_INTERFACE=true
|
| 40 |
+
CMD ["uvicorn", "ppt_agent.server.app:app", "--host", "0.0.0.0", "--port", "7860", "--log-level", "info"]
|
agent_action_tools.py
CHANGED
|
@@ -6,7 +6,13 @@ from typing import Annotated, Any, Literal
|
|
| 6 |
|
| 7 |
from pydantic import BaseModel, ConfigDict, Field
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
class _StrictModel(BaseModel):
|
|
|
|
| 6 |
|
| 7 |
from pydantic import BaseModel, ConfigDict, Field
|
| 8 |
|
| 9 |
+
try:
|
| 10 |
+
from models import PptAgentAction
|
| 11 |
+
except ImportError:
|
| 12 |
+
try:
|
| 13 |
+
from ppt_agent.models import PptAgentAction
|
| 14 |
+
except ImportError:
|
| 15 |
+
from .models import PptAgentAction
|
| 16 |
|
| 17 |
|
| 18 |
class _StrictModel(BaseModel):
|
client.py
CHANGED
|
@@ -6,7 +6,13 @@ from openenv.core import EnvClient
|
|
| 6 |
from openenv.core.client_types import StepResult
|
| 7 |
from openenv.core.env_server.types import State
|
| 8 |
|
| 9 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 10 |
|
| 11 |
|
| 12 |
class PptAgentEnv(EnvClient[PptAgentAction, PptAgentObservation, State]):
|
|
|
|
| 6 |
from openenv.core.client_types import StepResult
|
| 7 |
from openenv.core.env_server.types import State
|
| 8 |
|
| 9 |
+
try:
|
| 10 |
+
from models import PptAgentAction, PptAgentObservation
|
| 11 |
+
except ImportError:
|
| 12 |
+
try:
|
| 13 |
+
from ppt_agent.models import PptAgentAction, PptAgentObservation
|
| 14 |
+
except ImportError:
|
| 15 |
+
from .models import PptAgentAction, PptAgentObservation
|
| 16 |
|
| 17 |
|
| 18 |
class PptAgentEnv(EnvClient[PptAgentAction, PptAgentObservation, State]):
|
inference_debug.py
CHANGED
|
@@ -24,14 +24,34 @@ except ImportError: # pragma: no cover
|
|
| 24 |
return None
|
| 25 |
|
| 26 |
|
| 27 |
-
|
| 28 |
-
|
| 29 |
-
|
| 30 |
-
|
| 31 |
-
|
| 32 |
-
|
| 33 |
-
|
| 34 |
-
from
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 35 |
|
| 36 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 37 |
|
|
|
|
| 24 |
return None
|
| 25 |
|
| 26 |
|
| 27 |
+
try:
|
| 28 |
+
from agent_action_tools import (
|
| 29 |
+
AgentToolInvocation,
|
| 30 |
+
build_openai_tools,
|
| 31 |
+
parse_tool_invocation,
|
| 32 |
+
tool_invocation_to_action,
|
| 33 |
+
)
|
| 34 |
+
from client import PptAgentEnv
|
| 35 |
+
from models import PptAgentAction
|
| 36 |
+
except ImportError:
|
| 37 |
+
try:
|
| 38 |
+
from ppt_agent.agent_action_tools import (
|
| 39 |
+
AgentToolInvocation,
|
| 40 |
+
build_openai_tools,
|
| 41 |
+
parse_tool_invocation,
|
| 42 |
+
tool_invocation_to_action,
|
| 43 |
+
)
|
| 44 |
+
from ppt_agent.client import PptAgentEnv
|
| 45 |
+
from ppt_agent.models import PptAgentAction
|
| 46 |
+
except ImportError:
|
| 47 |
+
from .agent_action_tools import (
|
| 48 |
+
AgentToolInvocation,
|
| 49 |
+
build_openai_tools,
|
| 50 |
+
parse_tool_invocation,
|
| 51 |
+
tool_invocation_to_action,
|
| 52 |
+
)
|
| 53 |
+
from .client import PptAgentEnv
|
| 54 |
+
from .models import PptAgentAction
|
| 55 |
|
| 56 |
HF_TOKEN = os.getenv("HF_TOKEN")
|
| 57 |
|
openenv.yaml
CHANGED
|
@@ -2,5 +2,5 @@ spec_version: 1
|
|
| 2 |
name: ppt_agent
|
| 3 |
type: space
|
| 4 |
runtime: fastapi
|
| 5 |
-
app: server.app:app
|
| 6 |
port: 7860
|
|
|
|
| 2 |
name: ppt_agent
|
| 3 |
type: space
|
| 4 |
runtime: fastapi
|
| 5 |
+
app: ppt_agent.server.app:app
|
| 6 |
port: 7860
|
server/__init__.py
CHANGED
|
@@ -6,7 +6,6 @@
|
|
| 6 |
|
| 7 |
"""Ppt Agent environment server components."""
|
| 8 |
|
| 9 |
-
from .app import app
|
| 10 |
from .ppt_agent_environment import PptAgentEnvironment
|
| 11 |
|
| 12 |
-
__all__ = ["PptAgentEnvironment"
|
|
|
|
| 6 |
|
| 7 |
"""Ppt Agent environment server components."""
|
| 8 |
|
|
|
|
| 9 |
from .ppt_agent_environment import PptAgentEnvironment
|
| 10 |
|
| 11 |
+
__all__ = ["PptAgentEnvironment"]
|
server/app.py
CHANGED
|
@@ -30,14 +30,9 @@ Usage:
|
|
| 30 |
|
| 31 |
from openenv.core.env_server.http_server import create_app
|
| 32 |
|
| 33 |
-
|
| 34 |
-
|
| 35 |
-
|
| 36 |
-
from .utils.reward_metrics import preload_similarity_model
|
| 37 |
-
except ImportError:
|
| 38 |
-
from models import PptAgentAction, PptAgentObservation
|
| 39 |
-
from server.ppt_agent_environment import PptAgentEnvironment
|
| 40 |
-
from server.utils.reward_metrics import preload_similarity_model
|
| 41 |
|
| 42 |
|
| 43 |
# Create the app with web interface and README integration
|
|
|
|
| 30 |
|
| 31 |
from openenv.core.env_server.http_server import create_app
|
| 32 |
|
| 33 |
+
from ..models import PptAgentAction, PptAgentObservation
|
| 34 |
+
from .ppt_agent_environment import PptAgentEnvironment
|
| 35 |
+
from .utils.reward_metrics import preload_similarity_model
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 36 |
|
| 37 |
|
| 38 |
# Create the app with web interface and README integration
|
server/llm_client.py
CHANGED
|
@@ -7,7 +7,8 @@ import re
|
|
| 7 |
|
| 8 |
from openai import OpenAI
|
| 9 |
|
| 10 |
-
from
|
|
|
|
| 11 |
|
| 12 |
logger = logging.getLogger(__name__)
|
| 13 |
|
|
|
|
| 7 |
|
| 8 |
from openai import OpenAI
|
| 9 |
|
| 10 |
+
from .debug_logging import write_debug_event
|
| 11 |
+
|
| 12 |
|
| 13 |
logger = logging.getLogger(__name__)
|
| 14 |
|
server/ppt_agent_environment.py
CHANGED
|
@@ -1,50 +1,44 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
-
from dataclasses import dataclass
|
| 4 |
import logging
|
| 5 |
-
from pathlib import Path
|
| 6 |
import random
|
|
|
|
|
|
|
| 7 |
from typing import Any
|
| 8 |
from uuid import uuid4
|
| 9 |
|
| 10 |
from openenv.core.env_server.interfaces import Environment
|
| 11 |
from openenv.core.env_server.types import State
|
| 12 |
|
| 13 |
-
from
|
| 14 |
-
from
|
| 15 |
-
from
|
| 16 |
-
from
|
|
|
|
| 17 |
create_slide,
|
| 18 |
delete_slide,
|
| 19 |
register_theme,
|
| 20 |
save_presentation,
|
| 21 |
-
update_theme,
|
| 22 |
update_slide,
|
|
|
|
| 23 |
)
|
| 24 |
-
from
|
| 25 |
-
from
|
| 26 |
-
from
|
| 27 |
-
from
|
| 28 |
build_eval_spec,
|
| 29 |
evaluate_presentation,
|
| 30 |
evaluate_slide,
|
| 31 |
)
|
| 32 |
-
from
|
| 33 |
-
from
|
| 34 |
-
from server.utils.slidesgenbench import (
|
| 35 |
QuantitativeQuizJudgeService,
|
| 36 |
QuizBankGenerationService,
|
| 37 |
SlidesGenQuantitativeJudgeService,
|
| 38 |
SlidesGenQuizBankService,
|
| 39 |
)
|
| 40 |
|
| 41 |
-
|
| 42 |
-
from ..models import PptAgentAction, PptAgentObservation
|
| 43 |
-
except ImportError:
|
| 44 |
-
from models import PptAgentAction, PptAgentObservation
|
| 45 |
-
|
| 46 |
-
|
| 47 |
-
_DEFAULT_MAX_STEPS = 20
|
| 48 |
_INVALID_ACTION_PENALTY = 0.0
|
| 49 |
|
| 50 |
logger = logging.getLogger(__name__)
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
|
|
|
| 3 |
import logging
|
|
|
|
| 4 |
import random
|
| 5 |
+
from dataclasses import dataclass
|
| 6 |
+
from pathlib import Path
|
| 7 |
from typing import Any
|
| 8 |
from uuid import uuid4
|
| 9 |
|
| 10 |
from openenv.core.env_server.interfaces import Environment
|
| 11 |
from openenv.core.env_server.types import State
|
| 12 |
|
| 13 |
+
from ..models import PptAgentAction, PptAgentObservation
|
| 14 |
+
from .debug_logging import debug_context, write_debug_event
|
| 15 |
+
from .llm_client import LLMClient
|
| 16 |
+
from .task_registry import DEFAULT_TASK_REGISTRY, TaskRegistry, TaskScenario
|
| 17 |
+
from .tools.pptx_tools import (
|
| 18 |
create_slide,
|
| 19 |
delete_slide,
|
| 20 |
register_theme,
|
| 21 |
save_presentation,
|
|
|
|
| 22 |
update_slide,
|
| 23 |
+
update_theme,
|
| 24 |
)
|
| 25 |
+
from .utils.pptx_extraction import PptxExtractionService
|
| 26 |
+
from .utils.pptx_functions import PptxEditor
|
| 27 |
+
from .utils.rendering.pptx_render_service import PptxRenderService
|
| 28 |
+
from .utils.reward_kernel import (
|
| 29 |
build_eval_spec,
|
| 30 |
evaluate_presentation,
|
| 31 |
evaluate_slide,
|
| 32 |
)
|
| 33 |
+
from .utils.reward_models import EvalSpec, ExtractedPresentation, to_serializable
|
| 34 |
+
from .utils.slidesgenbench import (
|
|
|
|
| 35 |
QuantitativeQuizJudgeService,
|
| 36 |
QuizBankGenerationService,
|
| 37 |
SlidesGenQuantitativeJudgeService,
|
| 38 |
SlidesGenQuizBankService,
|
| 39 |
)
|
| 40 |
|
| 41 |
+
_DEFAULT_MAX_STEPS = 30
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 42 |
_INVALID_ACTION_PENALTY = 0.0
|
| 43 |
|
| 44 |
logger = logging.getLogger(__name__)
|
server/task_registry.py
CHANGED
|
@@ -6,8 +6,7 @@ from dataclasses import dataclass
|
|
| 6 |
from pathlib import Path
|
| 7 |
from typing import Any, Iterable
|
| 8 |
|
| 9 |
-
from
|
| 10 |
-
|
| 11 |
|
| 12 |
DEFAULT_THEME = {
|
| 13 |
"bg": "#F8FAFC",
|
|
@@ -108,9 +107,9 @@ def _build_source_document(payload: dict[str, Any]) -> SourceDocument:
|
|
| 108 |
text=str(payload["text"]).strip() if payload.get("text") is not None else None,
|
| 109 |
pages=pages,
|
| 110 |
images=payload.get("images"),
|
| 111 |
-
metadata=
|
| 112 |
-
|
| 113 |
-
|
| 114 |
)
|
| 115 |
|
| 116 |
|
|
@@ -120,9 +119,11 @@ def _build_task_constraints(payload: dict[str, Any]) -> TaskConstraints:
|
|
| 120 |
max_slides=payload.get("max_slides"),
|
| 121 |
target_audience=payload.get("target_audience"),
|
| 122 |
tone=payload.get("tone"),
|
| 123 |
-
extra_constraints=
|
| 124 |
-
|
| 125 |
-
|
|
|
|
|
|
|
| 126 |
)
|
| 127 |
|
| 128 |
|
|
|
|
| 6 |
from pathlib import Path
|
| 7 |
from typing import Any, Iterable
|
| 8 |
|
| 9 |
+
from .utils.reward_models import SourceDocument, SourcePack, TaskConstraints
|
|
|
|
| 10 |
|
| 11 |
DEFAULT_THEME = {
|
| 12 |
"bg": "#F8FAFC",
|
|
|
|
| 107 |
text=str(payload["text"]).strip() if payload.get("text") is not None else None,
|
| 108 |
pages=pages,
|
| 109 |
images=payload.get("images"),
|
| 110 |
+
metadata=(
|
| 111 |
+
payload.get("metadata") if isinstance(payload.get("metadata"), dict) else {}
|
| 112 |
+
),
|
| 113 |
)
|
| 114 |
|
| 115 |
|
|
|
|
| 119 |
max_slides=payload.get("max_slides"),
|
| 120 |
target_audience=payload.get("target_audience"),
|
| 121 |
tone=payload.get("tone"),
|
| 122 |
+
extra_constraints=(
|
| 123 |
+
payload.get("extra_constraints")
|
| 124 |
+
if isinstance(payload.get("extra_constraints"), dict)
|
| 125 |
+
else {}
|
| 126 |
+
),
|
| 127 |
)
|
| 128 |
|
| 129 |
|
server/tools/pptx_tools.py
CHANGED
|
@@ -4,7 +4,7 @@ from typing import Any, Dict, Optional
|
|
| 4 |
|
| 5 |
from pptx.util import Inches
|
| 6 |
|
| 7 |
-
from
|
| 8 |
|
| 9 |
|
| 10 |
_SHAPE_ID_UNSET = object()
|
|
|
|
| 4 |
|
| 5 |
from pptx.util import Inches
|
| 6 |
|
| 7 |
+
from ..utils.pptx_functions import PptxEditor
|
| 8 |
|
| 9 |
|
| 10 |
_SHAPE_ID_UNSET = object()
|
server/utils/pptx_extraction.py
CHANGED
|
@@ -10,8 +10,8 @@ from pptx import Presentation as load_presentation
|
|
| 10 |
from pptx.enum.dml import MSO_FILL
|
| 11 |
from pptx.presentation import Presentation as PptxPresentation
|
| 12 |
|
| 13 |
-
from
|
| 14 |
-
from
|
| 15 |
ExtractedChart,
|
| 16 |
ExtractedImage,
|
| 17 |
ExtractedPresentation,
|
|
|
|
| 10 |
from pptx.enum.dml import MSO_FILL
|
| 11 |
from pptx.presentation import Presentation as PptxPresentation
|
| 12 |
|
| 13 |
+
from .pptx_functions import PptxEditor
|
| 14 |
+
from .reward_models import (
|
| 15 |
ExtractedChart,
|
| 16 |
ExtractedImage,
|
| 17 |
ExtractedPresentation,
|
server/utils/presentbench/__init__.py
CHANGED
|
@@ -1,8 +1,8 @@
|
|
| 1 |
-
from
|
| 2 |
score_presentbench,
|
| 3 |
score_presentbench_slide,
|
| 4 |
)
|
| 5 |
-
from
|
| 6 |
|
| 7 |
__all__ = [
|
| 8 |
"build_presentbench_eval_spec",
|
|
|
|
| 1 |
+
from .scoring import (
|
| 2 |
score_presentbench,
|
| 3 |
score_presentbench_slide,
|
| 4 |
)
|
| 5 |
+
from .spec_builder import build_presentbench_eval_spec
|
| 6 |
|
| 7 |
__all__ = [
|
| 8 |
"build_presentbench_eval_spec",
|
server/utils/presentbench/metrics.py
CHANGED
|
@@ -4,7 +4,7 @@ from collections import defaultdict
|
|
| 4 |
from statistics import median
|
| 5 |
from typing import Any
|
| 6 |
|
| 7 |
-
from
|
| 8 |
clamp,
|
| 9 |
compute_overlap_ratio,
|
| 10 |
deck_text_corpus,
|
|
@@ -14,7 +14,7 @@ from server.utils.reward_metrics import (
|
|
| 14 |
slide_text_corpus,
|
| 15 |
text_match_score,
|
| 16 |
)
|
| 17 |
-
from
|
| 18 |
ChecklistItem,
|
| 19 |
ExtractedPresentation,
|
| 20 |
ExtractedShape,
|
|
|
|
| 4 |
from statistics import median
|
| 5 |
from typing import Any
|
| 6 |
|
| 7 |
+
from ..reward_metrics import (
|
| 8 |
clamp,
|
| 9 |
compute_overlap_ratio,
|
| 10 |
deck_text_corpus,
|
|
|
|
| 14 |
slide_text_corpus,
|
| 15 |
text_match_score,
|
| 16 |
)
|
| 17 |
+
from ..reward_models import (
|
| 18 |
ChecklistItem,
|
| 19 |
ExtractedPresentation,
|
| 20 |
ExtractedShape,
|
server/utils/presentbench/scoring.py
CHANGED
|
@@ -2,7 +2,7 @@ from __future__ import annotations
|
|
| 2 |
|
| 3 |
from typing import Any
|
| 4 |
|
| 5 |
-
from
|
| 6 |
compute_aesthetics_scores,
|
| 7 |
compute_presentation_diagnostics,
|
| 8 |
compute_slide_staleness_penalty,
|
|
@@ -12,12 +12,12 @@ from server.utils.presentbench.metrics import (
|
|
| 12 |
score_generic_slide_checklist_items,
|
| 13 |
score_slide_checklist_item,
|
| 14 |
)
|
| 15 |
-
from
|
| 16 |
clamp,
|
| 17 |
compute_overlap_ratio,
|
| 18 |
is_blank_or_title_only,
|
| 19 |
)
|
| 20 |
-
from
|
| 21 |
IntermediateSlideRewardResult,
|
| 22 |
PresentBenchEvalSpec,
|
| 23 |
PresentBenchScoreResult,
|
|
|
|
| 2 |
|
| 3 |
from typing import Any
|
| 4 |
|
| 5 |
+
from .metrics import (
|
| 6 |
compute_aesthetics_scores,
|
| 7 |
compute_presentation_diagnostics,
|
| 8 |
compute_slide_staleness_penalty,
|
|
|
|
| 12 |
score_generic_slide_checklist_items,
|
| 13 |
score_slide_checklist_item,
|
| 14 |
)
|
| 15 |
+
from ..reward_metrics import (
|
| 16 |
clamp,
|
| 17 |
compute_overlap_ratio,
|
| 18 |
is_blank_or_title_only,
|
| 19 |
)
|
| 20 |
+
from ..reward_models import (
|
| 21 |
IntermediateSlideRewardResult,
|
| 22 |
PresentBenchEvalSpec,
|
| 23 |
PresentBenchScoreResult,
|
server/utils/presentbench/spec_builder.py
CHANGED
|
@@ -3,7 +3,7 @@ from __future__ import annotations
|
|
| 3 |
import hashlib
|
| 4 |
import json
|
| 5 |
|
| 6 |
-
from
|
| 7 |
ChecklistItem,
|
| 8 |
PresentBenchEvalSpec,
|
| 9 |
TaskSpec,
|
|
|
|
| 3 |
import hashlib
|
| 4 |
import json
|
| 5 |
|
| 6 |
+
from ..reward_models import (
|
| 7 |
ChecklistItem,
|
| 8 |
PresentBenchEvalSpec,
|
| 9 |
TaskSpec,
|
server/utils/rendering/__init__.py
CHANGED
|
@@ -1,3 +1,3 @@
|
|
| 1 |
-
from
|
| 2 |
|
| 3 |
__all__ = ["PptxRenderService"]
|
|
|
|
| 1 |
+
from .pptx_render_service import PptxRenderService
|
| 2 |
|
| 3 |
__all__ = ["PptxRenderService"]
|
server/utils/rendering/pptx_render_service.py
CHANGED
|
@@ -11,9 +11,9 @@ from typing import Any
|
|
| 11 |
from PIL import Image
|
| 12 |
from pptx.presentation import Presentation as PptxPresentation
|
| 13 |
|
| 14 |
-
from
|
| 15 |
-
from
|
| 16 |
-
from
|
| 17 |
|
| 18 |
|
| 19 |
class PptxRenderService:
|
|
|
|
| 11 |
from PIL import Image
|
| 12 |
from pptx.presentation import Presentation as PptxPresentation
|
| 13 |
|
| 14 |
+
from ..pptx_extraction import open_presentation, presentation_digest
|
| 15 |
+
from ..pptx_functions import PptxEditor
|
| 16 |
+
from ..reward_models import RenderedPresentation, RenderedSlideImage
|
| 17 |
|
| 18 |
|
| 19 |
class PptxRenderService:
|
server/utils/reward_kernel.py
CHANGED
|
@@ -7,15 +7,15 @@ from typing import Any
|
|
| 7 |
|
| 8 |
from pptx.presentation import Presentation as PptxPresentation
|
| 9 |
|
| 10 |
-
from
|
| 11 |
-
from
|
| 12 |
score_presentbench,
|
| 13 |
score_presentbench_slide,
|
| 14 |
)
|
| 15 |
-
from
|
| 16 |
-
from
|
| 17 |
-
from
|
| 18 |
-
from
|
| 19 |
EvalSpec,
|
| 20 |
IntermediateSlideRewardResult,
|
| 21 |
RewardResult,
|
|
@@ -24,17 +24,17 @@ from server.utils.reward_models import (
|
|
| 24 |
TaskConstraints,
|
| 25 |
to_serializable,
|
| 26 |
)
|
| 27 |
-
from
|
| 28 |
-
from
|
| 29 |
-
from
|
| 30 |
QuantitativeQuizJudgeService,
|
| 31 |
)
|
| 32 |
-
from
|
| 33 |
-
from
|
| 34 |
-
from
|
| 35 |
compute_intermediate_rendered_aesthetics_score,
|
| 36 |
)
|
| 37 |
-
from
|
| 38 |
|
| 39 |
SPEC_VERSION = "1.0"
|
| 40 |
INTERMEDIATE_SLIDESGENBENCH_AESTHETIC_WEIGHT = 0.20
|
|
|
|
| 7 |
|
| 8 |
from pptx.presentation import Presentation as PptxPresentation
|
| 9 |
|
| 10 |
+
from .pptx_functions import PptxEditor
|
| 11 |
+
from .presentbench.scoring import (
|
| 12 |
score_presentbench,
|
| 13 |
score_presentbench_slide,
|
| 14 |
)
|
| 15 |
+
from .presentbench.spec_builder import build_presentbench_eval_spec
|
| 16 |
+
from .pptx_extraction import PptxExtractionService
|
| 17 |
+
from .reward_metrics import clamp
|
| 18 |
+
from .reward_models import (
|
| 19 |
EvalSpec,
|
| 20 |
IntermediateSlideRewardResult,
|
| 21 |
RewardResult,
|
|
|
|
| 24 |
TaskConstraints,
|
| 25 |
to_serializable,
|
| 26 |
)
|
| 27 |
+
from .reward_prompts import build_task_spec
|
| 28 |
+
from .slidesgenbench.quizbank_service import QuizBankGenerationService
|
| 29 |
+
from .slidesgenbench.quantitative_judge import (
|
| 30 |
QuantitativeQuizJudgeService,
|
| 31 |
)
|
| 32 |
+
from .slidesgenbench.scoring import score_slidesgenbench
|
| 33 |
+
from .slidesgenbench.spec_builder import build_slidesgenbench_eval_spec
|
| 34 |
+
from .slidesgenbench.rendered_aesthetics import (
|
| 35 |
compute_intermediate_rendered_aesthetics_score,
|
| 36 |
)
|
| 37 |
+
from .slidesgenbench.text_layout import compute_slide_text_layout_scores
|
| 38 |
|
| 39 |
SPEC_VERSION = "1.0"
|
| 40 |
INTERMEDIATE_SLIDESGENBENCH_AESTHETIC_WEIGHT = 0.20
|
server/utils/reward_metrics.py
CHANGED
|
@@ -7,7 +7,7 @@ from typing import Any
|
|
| 7 |
|
| 8 |
import numpy as np
|
| 9 |
|
| 10 |
-
from
|
| 11 |
|
| 12 |
|
| 13 |
_NUMBER_PATTERN = re.compile(r"\b\d+(?:\.\d+)?%?\b")
|
|
|
|
| 7 |
|
| 8 |
import numpy as np
|
| 9 |
|
| 10 |
+
from .reward_models import ExtractedPresentation, ExtractedSlide
|
| 11 |
|
| 12 |
|
| 13 |
_NUMBER_PATTERN = re.compile(r"\b\d+(?:\.\d+)?%?\b")
|
server/utils/reward_prompts.py
CHANGED
|
@@ -6,7 +6,7 @@ import re
|
|
| 6 |
from dataclasses import dataclass
|
| 7 |
from typing import Any
|
| 8 |
|
| 9 |
-
from
|
| 10 |
RequiredSlideSpec,
|
| 11 |
SourcePack,
|
| 12 |
TaskConstraints,
|
|
|
|
| 6 |
from dataclasses import dataclass
|
| 7 |
from typing import Any
|
| 8 |
|
| 9 |
+
from .reward_models import (
|
| 10 |
RequiredSlideSpec,
|
| 11 |
SourcePack,
|
| 12 |
TaskConstraints,
|
server/utils/slidesgenbench/__init__.py
CHANGED
|
@@ -1,14 +1,14 @@
|
|
| 1 |
-
from
|
| 2 |
QuizBankGenerationService,
|
| 3 |
SlidesGenQuizBankService,
|
| 4 |
)
|
| 5 |
-
from
|
| 6 |
QuantitativeQuizJudgeService,
|
| 7 |
SlidesGenQuantitativeJudgeService,
|
| 8 |
)
|
| 9 |
-
from
|
| 10 |
-
from
|
| 11 |
-
from
|
| 12 |
compute_presentation_text_layout_scores,
|
| 13 |
compute_slide_text_layout_scores,
|
| 14 |
)
|
|
|
|
| 1 |
+
from .quizbank_service import (
|
| 2 |
QuizBankGenerationService,
|
| 3 |
SlidesGenQuizBankService,
|
| 4 |
)
|
| 5 |
+
from .quantitative_judge import (
|
| 6 |
QuantitativeQuizJudgeService,
|
| 7 |
SlidesGenQuantitativeJudgeService,
|
| 8 |
)
|
| 9 |
+
from .scoring import score_slidesgenbench
|
| 10 |
+
from .spec_builder import build_slidesgenbench_eval_spec
|
| 11 |
+
from .text_layout import (
|
| 12 |
compute_presentation_text_layout_scores,
|
| 13 |
compute_slide_text_layout_scores,
|
| 14 |
)
|
server/utils/slidesgenbench/prompts.py
CHANGED
|
@@ -3,8 +3,8 @@ from __future__ import annotations
|
|
| 3 |
import json
|
| 4 |
import re
|
| 5 |
|
| 6 |
-
from
|
| 7 |
-
from
|
| 8 |
ExtractedPresentation,
|
| 9 |
QuizEvidenceBundle,
|
| 10 |
QuizQuestion,
|
|
|
|
| 3 |
import json
|
| 4 |
import re
|
| 5 |
|
| 6 |
+
from ..reward_metrics import slide_text_corpus
|
| 7 |
+
from ..reward_models import (
|
| 8 |
ExtractedPresentation,
|
| 9 |
QuizEvidenceBundle,
|
| 10 |
QuizQuestion,
|
server/utils/slidesgenbench/quantitative_judge.py
CHANGED
|
@@ -2,11 +2,11 @@ from __future__ import annotations
|
|
| 2 |
|
| 3 |
from typing import Any, Protocol
|
| 4 |
|
| 5 |
-
from
|
| 6 |
-
from
|
| 7 |
build_quantitative_quiz_judging_prompts,
|
| 8 |
)
|
| 9 |
-
from
|
| 10 |
ExtractedPresentation,
|
| 11 |
QuizQuestion,
|
| 12 |
TaskSpec,
|
|
|
|
| 2 |
|
| 3 |
from typing import Any, Protocol
|
| 4 |
|
| 5 |
+
from ...llm_client import LLMClient
|
| 6 |
+
from .prompts import (
|
| 7 |
build_quantitative_quiz_judging_prompts,
|
| 8 |
)
|
| 9 |
+
from ..reward_models import (
|
| 10 |
ExtractedPresentation,
|
| 11 |
QuizQuestion,
|
| 12 |
TaskSpec,
|
server/utils/slidesgenbench/quizbank_service.py
CHANGED
|
@@ -5,9 +5,9 @@ import logging
|
|
| 5 |
import re
|
| 6 |
from typing import Any, Protocol
|
| 7 |
|
| 8 |
-
from
|
| 9 |
-
from
|
| 10 |
-
from
|
| 11 |
QuizEvidence,
|
| 12 |
QuizEvidenceBundle,
|
| 13 |
QuizQuestion,
|
|
@@ -15,7 +15,7 @@ from server.utils.reward_models import (
|
|
| 15 |
TaskSpec,
|
| 16 |
to_serializable,
|
| 17 |
)
|
| 18 |
-
from
|
| 19 |
build_quiz_extraction_prompts,
|
| 20 |
build_quiz_generation_prompts,
|
| 21 |
build_quiz_refinement_prompts,
|
|
|
|
| 5 |
import re
|
| 6 |
from typing import Any, Protocol
|
| 7 |
|
| 8 |
+
from ...debug_logging import write_debug_event
|
| 9 |
+
from ...llm_client import LLMClient
|
| 10 |
+
from ..reward_models import (
|
| 11 |
QuizEvidence,
|
| 12 |
QuizEvidenceBundle,
|
| 13 |
QuizQuestion,
|
|
|
|
| 15 |
TaskSpec,
|
| 16 |
to_serializable,
|
| 17 |
)
|
| 18 |
+
from .prompts import (
|
| 19 |
build_quiz_extraction_prompts,
|
| 20 |
build_quiz_generation_prompts,
|
| 21 |
build_quiz_refinement_prompts,
|
server/utils/slidesgenbench/rendered_aesthetics.py
CHANGED
|
@@ -6,8 +6,8 @@ from typing import Any
|
|
| 6 |
import numpy as np
|
| 7 |
from PIL import Image
|
| 8 |
|
| 9 |
-
from
|
| 10 |
-
from
|
| 11 |
ExtractedPresentation,
|
| 12 |
ExtractedSlide,
|
| 13 |
RenderedPresentation,
|
|
|
|
| 6 |
import numpy as np
|
| 7 |
from PIL import Image
|
| 8 |
|
| 9 |
+
from ..reward_metrics import clamp, compute_overlap_ratio
|
| 10 |
+
from ..reward_models import (
|
| 11 |
ExtractedPresentation,
|
| 12 |
ExtractedSlide,
|
| 13 |
RenderedPresentation,
|
server/utils/slidesgenbench/scoring.py
CHANGED
|
@@ -1,19 +1,19 @@
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
-
from
|
| 4 |
-
from
|
| 5 |
-
from
|
| 6 |
ExtractedPresentation,
|
| 7 |
RenderedPresentation,
|
| 8 |
SlidesGenBenchEvalSpec,
|
| 9 |
SlidesGenBenchScoreResult,
|
| 10 |
TaskSpec,
|
| 11 |
)
|
| 12 |
-
from
|
| 13 |
-
from
|
| 14 |
compute_rendered_aesthetics_scores,
|
| 15 |
)
|
| 16 |
-
from
|
| 17 |
compute_presentation_text_layout_scores,
|
| 18 |
)
|
| 19 |
|
|
|
|
| 1 |
from __future__ import annotations
|
| 2 |
|
| 3 |
+
from ..reward_metrics import slide_text_corpus, text_match_score
|
| 4 |
+
from ..reward_metrics import clamp
|
| 5 |
+
from ..reward_models import (
|
| 6 |
ExtractedPresentation,
|
| 7 |
RenderedPresentation,
|
| 8 |
SlidesGenBenchEvalSpec,
|
| 9 |
SlidesGenBenchScoreResult,
|
| 10 |
TaskSpec,
|
| 11 |
)
|
| 12 |
+
from .quantitative_judge import QuantitativeQuizJudgeService
|
| 13 |
+
from .rendered_aesthetics import (
|
| 14 |
compute_rendered_aesthetics_scores,
|
| 15 |
)
|
| 16 |
+
from .text_layout import (
|
| 17 |
compute_presentation_text_layout_scores,
|
| 18 |
)
|
| 19 |
|
server/utils/slidesgenbench/spec_builder.py
CHANGED
|
@@ -3,13 +3,13 @@ from __future__ import annotations
|
|
| 3 |
import hashlib
|
| 4 |
import json
|
| 5 |
|
| 6 |
-
from
|
| 7 |
SlidesGenBenchEvalSpec,
|
| 8 |
SourcePack,
|
| 9 |
TaskSpec,
|
| 10 |
to_serializable,
|
| 11 |
)
|
| 12 |
-
from
|
| 13 |
|
| 14 |
SPEC_VERSION = "1.0"
|
| 15 |
|
|
|
|
| 3 |
import hashlib
|
| 4 |
import json
|
| 5 |
|
| 6 |
+
from ..reward_models import (
|
| 7 |
SlidesGenBenchEvalSpec,
|
| 8 |
SourcePack,
|
| 9 |
TaskSpec,
|
| 10 |
to_serializable,
|
| 11 |
)
|
| 12 |
+
from .quizbank_service import QuizBankGenerationService
|
| 13 |
|
| 14 |
SPEC_VERSION = "1.0"
|
| 15 |
|
server/utils/slidesgenbench/text_layout.py
CHANGED
|
@@ -4,8 +4,8 @@ from typing import Any
|
|
| 4 |
|
| 5 |
import numpy as np
|
| 6 |
|
| 7 |
-
from
|
| 8 |
-
from
|
| 9 |
ExtractedPresentation,
|
| 10 |
ExtractedShape,
|
| 11 |
ExtractedSlide,
|
|
|
|
| 4 |
|
| 5 |
import numpy as np
|
| 6 |
|
| 7 |
+
from ..reward_metrics import clamp
|
| 8 |
+
from ..reward_models import (
|
| 9 |
ExtractedPresentation,
|
| 10 |
ExtractedShape,
|
| 11 |
ExtractedSlide,
|