diff --git a/build/lib/gradio/interface.py b/build/lib/gradio/interface.py index 2867d5ecdb..7ed0bce563 100644 --- a/build/lib/gradio/interface.py +++ b/build/lib/gradio/interface.py @@ -19,9 +19,15 @@ import inspect from IPython import get_ipython import sys import weakref +import analytics +import socket 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: @@ -89,6 +95,21 @@ class Interface: self.simple_server = None 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): config = { "input_interfaces": [ @@ -184,6 +205,12 @@ class Interface: processed_input = self.input_interface.preprocess(msg) prediction = self.predict(processed_input) 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: print("\n----------") print( @@ -194,6 +221,12 @@ class Interface: try: _ = self.output_interface.postprocess(prediction) 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: print("\n----------") print( @@ -250,6 +283,12 @@ class Interface: is_colab = True print("Google colab notebook detected.") 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 try: @@ -278,6 +317,12 @@ class Interface: share_url = networking.setup_tunnel(server_port) print("Running on External URL:", share_url) 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 if self.verbose: print(strings.en["NGROK_NO_INTERNET"]) @@ -343,6 +388,19 @@ class Interface: sys.stdout.flush() 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 @classmethod diff --git a/dist/gradio-0.9.9-py3-none-any.whl b/dist/gradio-0.9.9-py3-none-any.whl new file mode 100644 index 0000000000..735a09d886 Binary files /dev/null and b/dist/gradio-0.9.9-py3-none-any.whl differ diff --git a/gradio.egg-info/PKG-INFO b/gradio.egg-info/PKG-INFO index 4ca224d33b..c2d6aa759c 100644 --- a/gradio.egg-info/PKG-INFO +++ b/gradio.egg-info/PKG-INFO @@ -1,6 +1,6 @@ Metadata-Version: 1.0 Name: gradio -Version: 0.9.8 +Version: 0.9.9 Summary: Python library for easily interacting with trained machine learning models Home-page: https://github.com/gradio-app/gradio-UI Author: Abubakar Abid diff --git a/upload_to_pypi.sh b/upload_to_pypi.sh old mode 100644 new mode 100755