Spaces:
Running on Zero
Running on Zero
Drop Gradio's generated stub
Browse files- race_view.pyi +0 -40
race_view.pyi
DELETED
|
@@ -1,40 +0,0 @@
|
|
| 1 |
-
"""RaceView, a custom Gradio component: three readers' readings replayed at their measured pace, then Jev's scores
|
| 2 |
-
line by line. Its value is a `Race` payload (app.py); the drawing is in race_view.js and race_view.css."""
|
| 3 |
-
|
| 4 |
-
from __future__ import annotations
|
| 5 |
-
|
| 6 |
-
from pathlib import Path
|
| 7 |
-
from typing import Any
|
| 8 |
-
|
| 9 |
-
import gradio as gr
|
| 10 |
-
|
| 11 |
-
_HERE = Path(__file__).parent
|
| 12 |
-
HINT = (
|
| 13 |
-
"Pick a region and press Read: the three readers run one after the other, and each reading is replayed here at "
|
| 14 |
-
"the pace it was measured."
|
| 15 |
-
)
|
| 16 |
-
TEMPLATE = f'<div class="rv-root"><p class="rv-hint">{HINT}</p></div>'
|
| 17 |
-
|
| 18 |
-
from gradio.events import Dependency
|
| 19 |
-
|
| 20 |
-
class RaceView(gr.HTML):
|
| 21 |
-
"""Replays a `Race`: a bar and a text lane per reader, growing as the reader produced its tokens, and one row per
|
| 22 |
-
line with Jev's scores. Readings are written as text, never as HTML."""
|
| 23 |
-
|
| 24 |
-
def __init__(self, value: dict[str, Any] | None = None, **kwargs: Any) -> None:
|
| 25 |
-
super().__init__(
|
| 26 |
-
value=value,
|
| 27 |
-
html_template=TEMPLATE,
|
| 28 |
-
css_template=(_HERE / "race_view.css").read_text(encoding="utf-8"),
|
| 29 |
-
js_on_load=(_HERE / "race_view.js").read_text(encoding="utf-8"),
|
| 30 |
-
apply_default_css=False,
|
| 31 |
-
**kwargs,
|
| 32 |
-
)
|
| 33 |
-
|
| 34 |
-
def api_info(self) -> dict[str, Any]:
|
| 35 |
-
return {"type": "object", "title": "Race", "description": "Each reader's reading and timings, and Jev's scores"}
|
| 36 |
-
from typing import Callable, Literal, Sequence, Any, TYPE_CHECKING
|
| 37 |
-
from gradio.blocks import Block
|
| 38 |
-
if TYPE_CHECKING:
|
| 39 |
-
from gradio.components import Timer
|
| 40 |
-
from gradio.components.base import Component
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|