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
66d268bb02
commit
35e003faa2
@ -19,9 +19,15 @@ import inspect
|
|||||||
from IPython import get_ipython
|
from IPython import get_ipython
|
||||||
import sys
|
import sys
|
||||||
import weakref
|
import weakref
|
||||||
|
import analytics
|
||||||
|
import socket
|
||||||
|
|
||||||
|
|
||||||
PKG_VERSION_URL = "https://gradio.app/api/pkg-version"
|
PKG_VERSION_URL = "https://gradio.app/api/pkg-version"
|
||||||
|
analytics.write_key = "uxIFddIEuuUcFLf9VgH2teTEtPlWdkNy"
|
||||||
|
analytics_url = 'https://api.gradio.app/'
|
||||||
|
hostname = socket.gethostname()
|
||||||
|
ip_address = socket.gethostbyname(hostname)
|
||||||
|
|
||||||
|
|
||||||
class Interface:
|
class Interface:
|
||||||
@ -89,6 +95,21 @@ class Interface:
|
|||||||
self.simple_server = None
|
self.simple_server = None
|
||||||
Interface.instances.add(self)
|
Interface.instances.add(self)
|
||||||
|
|
||||||
|
data = {'fn': fn,
|
||||||
|
'inputs': inputs,
|
||||||
|
'outputs': outputs,
|
||||||
|
'saliency': saliency,
|
||||||
|
'live': live,
|
||||||
|
'capture_session': capture_session,
|
||||||
|
'host_name': hostname,
|
||||||
|
'ip_address': ip_address
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
requests.post(analytics_url + 'gradio-initiated-analytics/',
|
||||||
|
data=data)
|
||||||
|
except requests.ConnectionError:
|
||||||
|
print("gradio-initiated-analytics/ Connection Error")
|
||||||
|
|
||||||
def get_config_file(self):
|
def get_config_file(self):
|
||||||
config = {
|
config = {
|
||||||
"input_interfaces": [
|
"input_interfaces": [
|
||||||
@ -184,6 +205,12 @@ class Interface:
|
|||||||
processed_input = self.input_interface.preprocess(msg)
|
processed_input = self.input_interface.preprocess(msg)
|
||||||
prediction = self.predict(processed_input)
|
prediction = self.predict(processed_input)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
data = {'error': e}
|
||||||
|
try:
|
||||||
|
requests.post(analytics_url + 'gradio-error-analytics/',
|
||||||
|
data=data)
|
||||||
|
except requests.ConnectionError:
|
||||||
|
print("gradio-error-analytics/ Connection Error")
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print("\n----------")
|
print("\n----------")
|
||||||
print(
|
print(
|
||||||
@ -194,6 +221,12 @@ class Interface:
|
|||||||
try:
|
try:
|
||||||
_ = self.output_interface.postprocess(prediction)
|
_ = self.output_interface.postprocess(prediction)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
|
data = {'error': e}
|
||||||
|
try:
|
||||||
|
requests.post(analytics_url + 'gradio-error-analytics/',
|
||||||
|
data=data)
|
||||||
|
except requests.ConnectionError:
|
||||||
|
print("gradio-error-analytics/ Connection Error")
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print("\n----------")
|
print("\n----------")
|
||||||
print(
|
print(
|
||||||
@ -250,6 +283,12 @@ class Interface:
|
|||||||
is_colab = True
|
is_colab = True
|
||||||
print("Google colab notebook detected.")
|
print("Google colab notebook detected.")
|
||||||
except NameError:
|
except NameError:
|
||||||
|
data = {'error': 'NameError in launch method'}
|
||||||
|
try:
|
||||||
|
requests.post(analytics_url + 'gradio-error-analytics/',
|
||||||
|
data=data)
|
||||||
|
except requests.ConnectionError:
|
||||||
|
print("Connection Error")
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -278,6 +317,12 @@ class Interface:
|
|||||||
share_url = networking.setup_tunnel(server_port)
|
share_url = networking.setup_tunnel(server_port)
|
||||||
print("Running on External URL:", share_url)
|
print("Running on External URL:", share_url)
|
||||||
except RuntimeError:
|
except RuntimeError:
|
||||||
|
data = {'error': 'RuntimeError in launch method'}
|
||||||
|
try:
|
||||||
|
requests.post(analytics_url + 'gradio-error-analytics/',
|
||||||
|
data=data)
|
||||||
|
except requests.ConnectionError:
|
||||||
|
print("Connection Error")
|
||||||
share_url = None
|
share_url = None
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print(strings.en["NGROK_NO_INTERNET"])
|
print(strings.en["NGROK_NO_INTERNET"])
|
||||||
@ -343,6 +388,19 @@ class Interface:
|
|||||||
sys.stdout.flush()
|
sys.stdout.flush()
|
||||||
time.sleep(0.1)
|
time.sleep(0.1)
|
||||||
|
|
||||||
|
launch_method = 'browser' if inbrowser else 'inline'
|
||||||
|
data = {'launch_method': launch_method,
|
||||||
|
'is_google_colab': is_colab,
|
||||||
|
'is_sharing_on': share,
|
||||||
|
'share_url': share_url,
|
||||||
|
'host_name': hostname,
|
||||||
|
'ip_address': ip_address
|
||||||
|
}
|
||||||
|
try:
|
||||||
|
requests.post(analytics_url + 'gradio-hosted-launched-analytics/',
|
||||||
|
data=data)
|
||||||
|
except requests.ConnectionError:
|
||||||
|
print("Connection Error")
|
||||||
return httpd, path_to_local_server, share_url
|
return httpd, path_to_local_server, share_url
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
BIN
dist/gradio-0.9.9-py3-none-any.whl
vendored
Normal file
BIN
dist/gradio-0.9.9-py3-none-any.whl
vendored
Normal file
Binary file not shown.
@ -1,6 +1,6 @@
|
|||||||
Metadata-Version: 1.0
|
Metadata-Version: 1.0
|
||||||
Name: gradio
|
Name: gradio
|
||||||
Version: 0.9.8
|
Version: 0.9.9
|
||||||
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
|
||||||
|
0
upload_to_pypi.sh
Normal file → Executable file
0
upload_to_pypi.sh
Normal file → Executable file
Loading…
Reference in New Issue
Block a user