mirror of
https://github.com/gradio-app/gradio.git
synced 2024-12-21 02:19:59 +08:00
updated PyPi version
This commit is contained in:
parent
b27920560a
commit
a04dfd592c
@ -14,7 +14,7 @@ from gradio.tunneling import create_tunnel
|
||||
import urllib.request
|
||||
from shutil import copyfile
|
||||
import requests
|
||||
import os
|
||||
import sys
|
||||
|
||||
|
||||
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):
|
||||
class HTTPHandler(SimpleHTTPRequestHandler):
|
||||
"""This handler uses server.base_path instead of always using os.getcwd()"""
|
||||
|
||||
def _set_headers(self):
|
||||
self.send_response(200)
|
||||
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):
|
||||
# Read body of the request.
|
||||
|
||||
if self.path == "/api/predict/":
|
||||
# Make the prediction.
|
||||
self._set_headers()
|
||||
@ -198,12 +196,13 @@ def serve_files_in_background(interface, port, directory_to_serve=None, server_n
|
||||
|
||||
# Now loop forever
|
||||
def serve_forever():
|
||||
# try:
|
||||
while True:
|
||||
# sys.stdout.flush()
|
||||
httpd.serve_forever()
|
||||
# except (KeyboardInterrupt, OSError):
|
||||
# httpd.server_close()
|
||||
try:
|
||||
while True:
|
||||
sys.stdout.flush()
|
||||
httpd.serve_forever()
|
||||
except (KeyboardInterrupt, OSError):
|
||||
httpd.shutdown()
|
||||
httpd.server_close()
|
||||
|
||||
thread = threading.Thread(target=serve_forever, daemon=False)
|
||||
thread.start()
|
||||
@ -215,13 +214,11 @@ def start_simple_server(interface, directory_to_serve=None, server_name=None):
|
||||
port = get_first_available_port(
|
||||
INITIAL_PORT_VALUE, INITIAL_PORT_VALUE + TRY_NUM_PORTS
|
||||
)
|
||||
httpd = serve_files_in_background(
|
||||
interface, port, directory_to_serve, server_name)
|
||||
httpd = serve_files_in_background(interface, port, directory_to_serve, server_name)
|
||||
return port, httpd
|
||||
|
||||
|
||||
def close_server(server):
|
||||
server.shutdown()
|
||||
server.server_close()
|
||||
|
||||
|
||||
|
BIN
dist/gradio-0.9.9.2-py3-none-any.whl
vendored
Normal file
BIN
dist/gradio-0.9.9.2-py3-none-any.whl
vendored
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
||||
Metadata-Version: 1.0
|
||||
Name: gradio
|
||||
Version: 0.9.9.1
|
||||
Version: 0.9.9.2
|
||||
Summary: Python library for easily interacting with trained machine learning models
|
||||
Home-page: https://github.com/gradio-app/gradio-UI
|
||||
Author: Abubakar Abid
|
||||
|
@ -4,3 +4,4 @@ paramiko
|
||||
scipy
|
||||
IPython
|
||||
scikit-image
|
||||
analytics-python
|
||||
|
Loading…
Reference in New Issue
Block a user