Created
July 14, 2019 09:43
-
-
Save badbye/ae7ab5db8984a4e81fcd3001c455cc1f to your computer and use it in GitHub Desktop.
Example of customized model
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# encoding: utf8 | |
import gradio | |
import re | |
import numpy as np | |
# A very simplistic function that capitalizes each letter in the given string | |
def big(x): | |
if re.match('^[a-zA-Z]+$', x): | |
return np.array([0.8, 0.2]) | |
return np.array([0.2, 0.8]) | |
output = gradio.outputs.Label(label_names=('英文字符', 'Non-English'), num_top_classes=2) | |
io = gradio.Interface(inputs="textbox", outputs=output, model=big, model_type='pyfunc') | |
io.launch() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment