mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-06 10:25:17 +08:00
fixed capture session code
This commit is contained in:
parent
58493e4a2b
commit
6c1648b287
@ -107,8 +107,16 @@ class Interface:
|
||||
'host_name': hostname,
|
||||
'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:
|
||||
print("try initiated")
|
||||
requests.post(analytics_url + 'gradio-initiated-analytics/',
|
||||
data=data)
|
||||
except requests.ConnectionError:
|
||||
@ -144,7 +152,6 @@ class Interface:
|
||||
|
||||
return config
|
||||
|
||||
|
||||
def process(self, raw_input):
|
||||
processed_input = [input_interface.preprocess(
|
||||
raw_input[i]) for i, input_interface in
|
||||
@ -262,14 +269,6 @@ class Interface:
|
||||
# if validate and not self.validate_flag:
|
||||
# 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()
|
||||
# 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)
|
||||
|
Loading…
Reference in New Issue
Block a user