updated PyPi version

This commit is contained in:
Abubakar Abid 2020-07-08 13:15:12 -05:00
parent b27920560a
commit a04dfd592c
4 changed files with 11 additions and 13 deletions

View File

@ -14,7 +14,7 @@ from gradio.tunneling import create_tunnel
import urllib.request import urllib.request
from shutil import copyfile from shutil import copyfile
import requests import requests
import os import sys
INITIAL_PORT_VALUE = ( INITIAL_PORT_VALUE = (
@ -117,7 +117,6 @@ def get_first_available_port(initial, final):
def serve_files_in_background(interface, port, directory_to_serve=None, server_name=LOCALHOST_NAME): def serve_files_in_background(interface, port, directory_to_serve=None, server_name=LOCALHOST_NAME):
class HTTPHandler(SimpleHTTPRequestHandler): class HTTPHandler(SimpleHTTPRequestHandler):
"""This handler uses server.base_path instead of always using os.getcwd()""" """This handler uses server.base_path instead of always using os.getcwd()"""
def _set_headers(self): def _set_headers(self):
self.send_response(200) self.send_response(200)
self.send_header("Content-type", "application/json") self.send_header("Content-type", "application/json")
@ -134,7 +133,6 @@ def serve_files_in_background(interface, port, directory_to_serve=None, server_n
def do_POST(self): def do_POST(self):
# Read body of the request. # Read body of the request.
if self.path == "/api/predict/": if self.path == "/api/predict/":
# Make the prediction. # Make the prediction.
self._set_headers() self._set_headers()
@ -198,12 +196,13 @@ def serve_files_in_background(interface, port, directory_to_serve=None, server_n
# Now loop forever # Now loop forever
def serve_forever(): def serve_forever():
# try: try:
while True: while True:
# sys.stdout.flush() sys.stdout.flush()
httpd.serve_forever() httpd.serve_forever()
# except (KeyboardInterrupt, OSError): except (KeyboardInterrupt, OSError):
# httpd.server_close() httpd.shutdown()
httpd.server_close()
thread = threading.Thread(target=serve_forever, daemon=False) thread = threading.Thread(target=serve_forever, daemon=False)
thread.start() thread.start()
@ -215,13 +214,11 @@ def start_simple_server(interface, directory_to_serve=None, server_name=None):
port = get_first_available_port( port = get_first_available_port(
INITIAL_PORT_VALUE, INITIAL_PORT_VALUE + TRY_NUM_PORTS INITIAL_PORT_VALUE, INITIAL_PORT_VALUE + TRY_NUM_PORTS
) )
httpd = serve_files_in_background( httpd = serve_files_in_background(interface, port, directory_to_serve, server_name)
interface, port, directory_to_serve, server_name)
return port, httpd return port, httpd
def close_server(server): def close_server(server):
server.shutdown()
server.server_close() server.server_close()

BIN
dist/gradio-0.9.9.2-py3-none-any.whl vendored Normal file

Binary file not shown.

View File

@ -1,6 +1,6 @@
Metadata-Version: 1.0 Metadata-Version: 1.0
Name: gradio Name: gradio
Version: 0.9.9.1 Version: 0.9.9.2
Summary: Python library for easily interacting with trained machine learning models Summary: Python library for easily interacting with trained machine learning models
Home-page: https://github.com/gradio-app/gradio-UI Home-page: https://github.com/gradio-app/gradio-UI
Author: Abubakar Abid Author: Abubakar Abid

View File

@ -4,3 +4,4 @@ paramiko
scipy scipy
IPython IPython
scikit-image scikit-image
analytics-python