fix issues

This commit is contained in:
duyalei 2019-07-14 13:24:13 +08:00
parent d84b85b515
commit 1ae1a90fac
2 changed files with 22 additions and 2 deletions

View File

@ -15,6 +15,7 @@ import pkg_resources
import requests
import random
import time
from IPython import get_ipython
LOCALHOST_IP = "127.0.0.1"
TRY_NUM_PORTS = 100
@ -136,7 +137,7 @@ class Interface:
Method that calls the relevant method of the model object to make a prediction.
:param preprocessed_input: the preprocessed input returned by the input interface
"""
print(preprocessed_input.shape)
# print(preprocessed_input.shape)
if self.model_type == "sklearn":
return self.model_obj.predict(preprocessed_input)
elif self.model_type == "keras":
@ -307,7 +308,7 @@ class Interface:
path_to_local_server
) # Open a browser tab with the interface.
if inline:
from IPython.display import IFrame
from IPython.display import IFrame, display
if (
is_colab

19
test.py Normal file
View File

@ -0,0 +1,19 @@
# encoding: utf8
"""
Created on 2019.07.14
@author: yalei
"""
import gradio
# A very simplistic function that capitalizes each letter in the given string
def big(x):
return x.upper()
io = gradio.Interface(inputs="textbox", outputs="textbox",
model=big, model_type='pyfunc')
# io.launch(inline=False, inbrowser=True, share=True)
io.launch()