Spaces:
Runtime error
Runtime error
"""Set up gradio api for cmataset.""" | |
# pylint: disable=invalid-name | |
from typing import List, Tuple, Union | |
import gradio as gr | |
import numpy as np | |
from cmat2aset import cmat2aset as c2a | |
from logzero import logger | |
def cmat2aset( | |
cmat: Union[np.ndarray, List[List]], | |
eps: float = 10, | |
min_samples: int = 6, | |
) -> Union[ | |
np.ndarray, List[Tuple[Union[int, str], Union[int, str], Union[float, str]]] | |
]: | |
"""Set up gradio api for cmataset.""" | |
try: | |
return c2a(cmat, eps, min_samples) | |
except Exception as exc: | |
logger.exception(exc) | |
raise | |
inputs = [ | |
"numpy", | |
gr.inputs.Slider( | |
minimum=1, | |
maximum=20, | |
step=0.1, | |
default=10, | |
), | |
gr.inputs.Slider( | |
minimum=1, | |
maximum=20, | |
step=1, | |
default=6, | |
), | |
] | |
iface = gr.Interface( | |
fn=cmat2aset, | |
inputs=inputs, | |
outputs="dataframe", | |
allow_flagging="never", | |
title="radio-cmat2aset", | |
) | |
iface.launch( | |
enable_queue=True, | |
) | |