diff --git a/gradio/external_utils.py b/gradio/external_utils.py index 8b69721aa9..3f342350ac 100644 --- a/gradio/external_utils.py +++ b/gradio/external_utils.py @@ -17,6 +17,14 @@ from gradio import components from gradio.exceptions import Error, TooManyRequestsError +_COLOR_MAP = { + "GET": "#61affe", + "POST": "#49cc90", + "PUT": "#fca130", + "DELETE": "#f93e3e", + "PATCH": "#50e3c2", +} + def get_model_info(model_name, hf_token=None): hf_api = HfApi(token=hf_token) @@ -586,19 +594,13 @@ def component_from_request_body_schema( def method_box(method: str) -> str: - color_map = { - "GET": "#61affe", - "POST": "#49cc90", - "PUT": "#fca130", - "DELETE": "#f93e3e", - "PATCH": "#50e3c2", - } - color = color_map.get(method.upper(), "#999") + method_upper = method.upper() + color = _COLOR_MAP.get(method_upper, "#999") return ( f"{method.upper()}" + f">{method_upper}" )