mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-06 10:25:17 +08:00
Merge branch 'master' of https://github.com/gradio-app/gradio-UI
This commit is contained in:
commit
24412d05ea
@ -20,13 +20,11 @@ from IPython import get_ipython
|
|||||||
import sys
|
import sys
|
||||||
import weakref
|
import weakref
|
||||||
import analytics
|
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.write_key = "uxIFddIEuuUcFLf9VgH2teTEtPlWdkNy"
|
||||||
analytics_url = 'https://api.gradio.app/'
|
analytics_url = 'https://api.gradio.app/'
|
||||||
hostname = socket.gethostname()
|
|
||||||
try:
|
try:
|
||||||
ip_address = requests.get('https://api.ipify.org').text
|
ip_address = requests.get('https://api.ipify.org').text
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
@ -104,15 +102,22 @@ class Interface:
|
|||||||
'saliency': saliency,
|
'saliency': saliency,
|
||||||
'live': live,
|
'live': live,
|
||||||
'capture_session': capture_session,
|
'capture_session': capture_session,
|
||||||
'host_name': hostname,
|
|
||||||
'ip_address': ip_address
|
'ip_address': ip_address
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.capture_session:
|
||||||
|
try:
|
||||||
|
import tensorflow as tf
|
||||||
|
self.session = tf.get_default_graph(), \
|
||||||
|
tf.keras.backend.get_session()
|
||||||
|
except (ImportError, AttributeError): # If they are using TF >= 2.0 or don't have TF, just ignore this.
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
print("try initiated")
|
|
||||||
requests.post(analytics_url + 'gradio-initiated-analytics/',
|
requests.post(analytics_url + 'gradio-initiated-analytics/',
|
||||||
data=data)
|
data=data)
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
print("gradio-initiated-analytics/ Connection Error")
|
pass # do not push analytics if no network
|
||||||
|
|
||||||
def get_config_file(self):
|
def get_config_file(self):
|
||||||
config = {
|
config = {
|
||||||
@ -144,7 +149,6 @@ class Interface:
|
|||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
def process(self, raw_input):
|
def process(self, raw_input):
|
||||||
processed_input = [input_interface.preprocess(
|
processed_input = [input_interface.preprocess(
|
||||||
raw_input[i]) for i, input_interface in
|
raw_input[i]) for i, input_interface in
|
||||||
@ -214,7 +218,7 @@ class Interface:
|
|||||||
requests.post(analytics_url + 'gradio-error-analytics/',
|
requests.post(analytics_url + 'gradio-error-analytics/',
|
||||||
data=data)
|
data=data)
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
print("gradio-error-analytics/ Connection Error")
|
pass # do not push analytics if no network
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print("\n----------")
|
print("\n----------")
|
||||||
print(
|
print(
|
||||||
@ -230,7 +234,7 @@ class Interface:
|
|||||||
requests.post(analytics_url + 'gradio-error-analytics/',
|
requests.post(analytics_url + 'gradio-error-analytics/',
|
||||||
data=data)
|
data=data)
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
print("gradio-error-analytics/ Connection Error")
|
pass # do not push analytics if no network
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print("\n----------")
|
print("\n----------")
|
||||||
print(
|
print(
|
||||||
@ -262,14 +266,6 @@ class Interface:
|
|||||||
# if validate and not self.validate_flag:
|
# if validate and not self.validate_flag:
|
||||||
# self.validate()
|
# self.validate()
|
||||||
|
|
||||||
if self.capture_session:
|
|
||||||
try:
|
|
||||||
import tensorflow as tf
|
|
||||||
self.session = tf.get_default_graph(), \
|
|
||||||
tf.keras.backend.get_session()
|
|
||||||
except (ImportError, AttributeError): # If they are using TF >= 2.0 or don't have TF, just ignore this.
|
|
||||||
pass
|
|
||||||
|
|
||||||
output_directory = tempfile.mkdtemp()
|
output_directory = tempfile.mkdtemp()
|
||||||
# Set up a port to serve the directory containing the static files with interface.
|
# Set up a port to serve the directory containing the static files with interface.
|
||||||
server_port, httpd = networking.start_simple_server(self, output_directory, self.server_name)
|
server_port, httpd = networking.start_simple_server(self, output_directory, self.server_name)
|
||||||
@ -291,7 +287,7 @@ class Interface:
|
|||||||
requests.post(analytics_url + 'gradio-error-analytics/',
|
requests.post(analytics_url + 'gradio-error-analytics/',
|
||||||
data=data)
|
data=data)
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
print("Connection Error")
|
pass # do not push analytics if no network
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
@ -325,7 +321,7 @@ class Interface:
|
|||||||
requests.post(analytics_url + 'gradio-error-analytics/',
|
requests.post(analytics_url + 'gradio-error-analytics/',
|
||||||
data=data)
|
data=data)
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
print("Connection Error")
|
pass # do not push analytics if no network
|
||||||
share_url = None
|
share_url = None
|
||||||
if self.verbose:
|
if self.verbose:
|
||||||
print(strings.en["NGROK_NO_INTERNET"])
|
print(strings.en["NGROK_NO_INTERNET"])
|
||||||
@ -397,14 +393,13 @@ class Interface:
|
|||||||
'is_google_colab': is_colab,
|
'is_google_colab': is_colab,
|
||||||
'is_sharing_on': share,
|
'is_sharing_on': share,
|
||||||
'share_url': share_url,
|
'share_url': share_url,
|
||||||
'host_name': hostname,
|
|
||||||
'ip_address': ip_address
|
'ip_address': ip_address
|
||||||
}
|
}
|
||||||
try:
|
try:
|
||||||
requests.post(analytics_url + 'gradio-launched-analytics/',
|
requests.post(analytics_url + 'gradio-launched-analytics/',
|
||||||
data=data)
|
data=data)
|
||||||
except requests.ConnectionError:
|
except requests.ConnectionError:
|
||||||
print("Connection Error")
|
pass # do not push analytics if no network
|
||||||
return httpd, path_to_local_server, share_url
|
return httpd, path_to_local_server, share_url
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
Metadata-Version: 1.0
|
Metadata-Version: 1.0
|
||||||
Name: gradio
|
Name: gradio
|
||||||
Version: 0.9.9.7
|
Version: 0.9.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
|
||||||
|
@ -104,6 +104,15 @@ class Interface:
|
|||||||
'capture_session': capture_session,
|
'capture_session': capture_session,
|
||||||
'ip_address': ip_address
|
'ip_address': ip_address
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if self.capture_session:
|
||||||
|
try:
|
||||||
|
import tensorflow as tf
|
||||||
|
self.session = tf.get_default_graph(), \
|
||||||
|
tf.keras.backend.get_session()
|
||||||
|
except (ImportError, AttributeError): # If they are using TF >= 2.0 or don't have TF, just ignore this.
|
||||||
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
requests.post(analytics_url + 'gradio-initiated-analytics/',
|
requests.post(analytics_url + 'gradio-initiated-analytics/',
|
||||||
data=data)
|
data=data)
|
||||||
@ -140,7 +149,6 @@ class Interface:
|
|||||||
|
|
||||||
return config
|
return config
|
||||||
|
|
||||||
|
|
||||||
def process(self, raw_input):
|
def process(self, raw_input):
|
||||||
processed_input = [input_interface.preprocess(
|
processed_input = [input_interface.preprocess(
|
||||||
raw_input[i]) for i, input_interface in
|
raw_input[i]) for i, input_interface in
|
||||||
@ -258,14 +266,6 @@ class Interface:
|
|||||||
# if validate and not self.validate_flag:
|
# if validate and not self.validate_flag:
|
||||||
# self.validate()
|
# self.validate()
|
||||||
|
|
||||||
if self.capture_session:
|
|
||||||
try:
|
|
||||||
import tensorflow as tf
|
|
||||||
self.session = tf.get_default_graph(), \
|
|
||||||
tf.keras.backend.get_session()
|
|
||||||
except (ImportError, AttributeError): # If they are using TF >= 2.0 or don't have TF, just ignore this.
|
|
||||||
pass
|
|
||||||
|
|
||||||
output_directory = tempfile.mkdtemp()
|
output_directory = tempfile.mkdtemp()
|
||||||
# Set up a port to serve the directory containing the static files with interface.
|
# Set up a port to serve the directory containing the static files with interface.
|
||||||
server_port, httpd = networking.start_simple_server(self, output_directory, self.server_name)
|
server_port, httpd = networking.start_simple_server(self, output_directory, self.server_name)
|
||||||
|
2
setup.py
2
setup.py
@ -5,7 +5,7 @@ except ImportError:
|
|||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='gradio',
|
name='gradio',
|
||||||
version='0.9.9.7',
|
version='0.9.9.9',
|
||||||
include_package_data=True,
|
include_package_data=True,
|
||||||
description='Python library for easily interacting with trained machine learning models',
|
description='Python library for easily interacting with trained machine learning models',
|
||||||
author='Abubakar Abid',
|
author='Abubakar Abid',
|
||||||
|
Loading…
Reference in New Issue
Block a user