File size: 201 Bytes
7bed60d
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
import gradio as gr

is_gradio_4: bool = 4 == int(str(gr.__version__).split(".")[0])


def js(func: str) -> dict:
    if is_gradio_4:
        return {"js": func}
    else:
        return {"_js": func}