updated pypi

This commit is contained in:
aliabd 2020-07-02 12:32:45 -07:00
parent 277fc5f5b1
commit c1ae971aad
10 changed files with 19 additions and 10 deletions

View File

@ -18,8 +18,7 @@ import time
import inspect
from IPython import get_ipython
LOCALHOST_IP = "0.0.0.0"
TRY_NUM_PORTS = 100
PKG_VERSION_URL = "https://gradio.app/api/pkg-version"
@ -32,7 +31,7 @@ class Interface:
def __init__(self, fn, inputs, outputs, saliency=None, verbose=False, examples=None,
live=False, show_input=True, show_output=True,
load_fn=None, capture_session=False, title=None, description=None,
thumbnail=None, server_name=LOCALHOST_IP):
thumbnail=None, server_name=networking.LOCALHOST_NAME):
"""
:param fn: a function that will process the input panel data from the interface and return the output panel data.
:param inputs: a string or `AbstractInput` representing the input interface.
@ -306,7 +305,8 @@ class Interface:
is_colab
): # Embed the remote interface page if on google colab;
# otherwise, embed the local page.
time.sleep(1)
while not networking.url_ok(share_url):
time.sleep(1)
display(IFrame(share_url, width=1000, height=500))
else:
display(IFrame(path_to_local_server, width=1000, height=500))

View File

@ -13,6 +13,7 @@ import json
from gradio.tunneling import create_tunnel
import urllib.request
from shutil import copyfile
import requests
INITIAL_PORT_VALUE = (
7860
@ -20,7 +21,7 @@ INITIAL_PORT_VALUE = (
TRY_NUM_PORTS = (
100
) # Number of ports to try before giving up and throwing an exception.
LOCALHOST_NAME = "0.0.0.0"
LOCALHOST_NAME = "127.0.0.1"
GRADIO_API_SERVER = "https://api.gradio.app/v1/tunnel-request"
STATIC_TEMPLATE_LIB = pkg_resources.resource_filename("gradio", "templates/")
@ -242,3 +243,11 @@ def setup_tunnel(local_server_port):
except Exception as e:
raise RuntimeError(str(e))
def url_ok(url):
try:
r = requests.head(url)
return r.status_code == 200
except ConnectionError:
return False

View File

@ -49,7 +49,7 @@ class Label(AbstractOutput):
def postprocess(self, prediction):
if isinstance(prediction, str):
return {"label": str}
return {"label": prediction}
elif isinstance(prediction, dict):
sorted_pred = sorted(
prediction.items(),

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
dist/gradio-0.9.6.tar.gz vendored Normal file

Binary file not shown.

View File

@ -1,8 +1,8 @@
Metadata-Version: 1.0
Name: gradio
Version: 0.9.5
Version: 0.9.6
Summary: Python library for easily interacting with trained machine learning models
Home-page: https://github.com/abidlabs/gradio
Home-page: https://github.com/gradio-app/gradio-UI
Author: Abubakar Abid
Author-email: a12d@stanford.edu
License: UNKNOWN

View File

@ -5,12 +5,12 @@ except ImportError:
setup(
name='gradio',
version='0.9.5',
version='0.9.6',
include_package_data=True,
description='Python library for easily interacting with trained machine learning models',
author='Abubakar Abid',
author_email='a12d@stanford.edu',
url='https://github.com/abidlabs/gradio',
url='https://github.com/gradio-app/gradio-UI',
packages=['gradio'],
keywords=['machine learning', 'visualization', 'reproducibility'],
install_requires=[