File size: 1,501 Bytes
e49e46a
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
3b99d6e
e49e46a
 
3b99d6e
e49e46a
 
 
 
 
 
 
 
3b99d6e
e49e46a
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
from gradio.components.base import Component

from gradio.events import Dependency

class Folium(Component):
    data_model = FileData

    def __init__(self, value: Any = None,
                 *, 
                 height: int | None = None,
                 label: str | None = None,
                 container: bool = True,
                 scale: int | None = None,
                 min_width: int | None = None,
                 visible: bool = True,
                 elem_id: str | None = None,
                 elem_classes: list[str] | str | None = None, 
                 render: bool = True,
                 load_fn: Callable[..., Any] | None = None,
                 every: float | None = None):
        super().__init__(value, label=label, info=None, show_label=True,
                         container=container, scale=scale, min_width=min_width,
                         visible=visible, elem_id=elem_id, elem_classes=elem_classes,
                         render=render,
                         load_fn=load_fn, every=every)
        self.height = height

    def preprocess(self, x):
        return x

    def postprocess(self, x: Map):
        if not x:
            return None
        with NamedTemporaryFile(suffix=".html", delete=False) as tmp:
            x.save(tmp.name)
            return FileData(path=tmp.name)

    def example_inputs(self):
        return {"info": "Do not use as input"}

    def api_info(self):
        return {"type": {}, "description": "any valid json"}