From d84b85b51519eda01b5c7a438e42f6b1f0f13d65 Mon Sep 17 00:00:00 2001 From: duyalei Date: Sun, 14 Jul 2019 13:17:41 +0800 Subject: [PATCH 1/3] set daemon=False --- gradio/networking.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gradio/networking.py b/gradio/networking.py index a935d64866..441ea4ad04 100644 --- a/gradio/networking.py +++ b/gradio/networking.py @@ -276,7 +276,7 @@ def serve_files_in_background(interface, port, directory_to_serve=None): # except (KeyboardInterrupt, OSError): # httpd.server_close() - thread = threading.Thread(target=serve_forever, daemon=True) + thread = threading.Thread(target=serve_forever, daemon=False) thread.start() return httpd From 1ae1a90facd6a1876180b3636b3732f91526784a Mon Sep 17 00:00:00 2001 From: duyalei Date: Sun, 14 Jul 2019 13:24:13 +0800 Subject: [PATCH 2/3] fix issues --- gradio/interface.py | 5 +++-- test.py | 19 +++++++++++++++++++ 2 files changed, 22 insertions(+), 2 deletions(-) create mode 100644 test.py diff --git a/gradio/interface.py b/gradio/interface.py index 8d0a0d9508..2f06016482 100644 --- a/gradio/interface.py +++ b/gradio/interface.py @@ -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 diff --git a/test.py b/test.py new file mode 100644 index 0000000000..55ae85164f --- /dev/null +++ b/test.py @@ -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() \ No newline at end of file From ff1940c8d52e7c43734100ba7c13a9fd554ec9fd Mon Sep 17 00:00:00 2001 From: duyalei Date: Sun, 14 Jul 2019 13:27:47 +0800 Subject: [PATCH 3/3] rm test.py --- test.py | 19 ------------------- 1 file changed, 19 deletions(-) delete mode 100644 test.py diff --git a/test.py b/test.py deleted file mode 100644 index 55ae85164f..0000000000 --- a/test.py +++ /dev/null @@ -1,19 +0,0 @@ -# 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() \ No newline at end of file