mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-21 02:19:59 +08:00
commit
b2950a55db
@ -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
|
||||
@ -134,6 +135,8 @@ 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)
|
||||
if self.model_type == "sklearn":
|
||||
return self.model_obj.predict(preprocessed_input)
|
||||
elif self.model_type == "keras":
|
||||
@ -304,7 +307,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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user