# `gradio_folium`
Display Interactive Maps Created with Folium
## Installation
```bash
pip install gradio_folium
```
## Usage
```python
import gradio as gr
from gradio_folium import Folium
from folium import Map
import pandas as pd
import pathlib
df = pd.read_csv(pathlib.Path(__file__).parent / "cities.csv")
def select(df, data: gr.SelectData):
row = df.iloc[data.index[0], :]
return Map(location=[row['Latitude'], row['Longitude']])
with gr.Blocks() as demo:
gr.Markdown(("# 🗺️ Explore World Capitals with Gradio and Folium\n"
"Install this custom component with `pip install gradio_folium`"))
map = Folium(value=Map(location=[25.7617, -80.1918]), height=400)
data = gr.DataFrame(value=df, height=200)
data.select(select, data, map)
if __name__ == "__main__":
demo.launch()
```
## `Folium`
### Initialization
name | type | default | description |
---|---|---|---|
value |
```python Any ``` | None |
None |
height |
```python int | None ``` | None |
None |
label |
```python str | None ``` | None |
None |
container |
```python bool ``` | True |
None |
scale |
```python int | None ``` | None |
None |
min_width |
```python int | None ``` | None |
None |
visible |
```python bool ``` | True |
None |
elem_id |
```python str | None ``` | None |
None |
elem_classes |
```python list[str] | str | None ``` | None |
None |
render |
```python bool ``` | True |
None |
load_fn |
```python Callable[Ellipsis, Any] | None ``` | None |
None |
every |
```python float | None ``` | None |
None |