Spaces:
Runtime error
Runtime error
File size: 1,083 Bytes
f2dd44e 29f0a11 eb44383 54855d5 29f0a11 f2dd44e 222b9bb f2dd44e 54855d5 f2dd44e e86eea2 f2dd44e 54855d5 |
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 43 44 45 |
"""Bootstrap."""
# pylint: disable=invalid-name
import numpy as np
import gradio as gr
from model_pool import load_model_s
from logzero import logger
from gradio_cmat import gradio_cmat
model_s = load_model_s()
def fn(text1: str, text2: str) -> np.ndarray:
"""Define."""
list1 = [elm.strip() for elm in text1.splitlines() if elm.strip()]
list2 = [elm.strip() for elm in text2.splitlines() if elm.strip()]
try:
res = gradio_cmat(list1, list2)
except Exception as e:
logger.error("gradio_cmat error: %s", e)
raise
return res
# _ = """
try:
interface = gr.Interface.load(
fn,
[
gr.inputs.Textbox(
lines=3, default="The quick brown fox jumped over the lazy dogs."
),
gr.inputs.Textbox(lines=3, default="The fast brown fox jumps over lazy dogs."),
],
"numpy",
description="Gen corralation matrix",
)
except Exception as e:
logger.exception("")
logger.error("gr.Interface.load(%s): %s", "fn", e)
raise
interface.launch()
|