mirror of
https://github.com/gradio-app/gradio.git
synced 2025-01-12 10:34:32 +08:00
better error parsing
This commit is contained in:
parent
5cc19c283a
commit
a04aca35f4
@ -115,13 +115,18 @@ class Interface:
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
prediction = predict_fn(*processed_input, self.context)
|
prediction = predict_fn(*processed_input, self.context)
|
||||||
except ValueError:
|
except ValueError as exception:
|
||||||
print("It looks like you might be "
|
if str(exception).endswith("is not an element "
|
||||||
"using tensorflow < 2.0. Please pass "
|
"of this graph."):
|
||||||
"capture_session=True in Interface to avoid "
|
print("It looks like you might be "
|
||||||
"a 'Tensor is not an element of this graph.' "
|
"using tensorflow < 2.0. Please pass "
|
||||||
"error.")
|
"capture_session=True in Interface to avoid "
|
||||||
prediction = predict_fn(*processed_input, self.context)
|
"the 'Tensor is not an element of this "
|
||||||
|
"graph.' "
|
||||||
|
"error.")
|
||||||
|
prediction = predict_fn(*processed_input)
|
||||||
|
else:
|
||||||
|
prediction = predict_fn(*processed_input)
|
||||||
else:
|
else:
|
||||||
if self.capture_session:
|
if self.capture_session:
|
||||||
graph, sess = self.session
|
graph, sess = self.session
|
||||||
@ -131,13 +136,17 @@ class Interface:
|
|||||||
else:
|
else:
|
||||||
try:
|
try:
|
||||||
prediction = predict_fn(*processed_input)
|
prediction = predict_fn(*processed_input)
|
||||||
except ValueError:
|
except ValueError as exception:
|
||||||
print("It looks like you might be "
|
if str(exception).endswith("is not an element "
|
||||||
|
"of this graph."):
|
||||||
|
print("It looks like you might be "
|
||||||
"using tensorflow < 2.0. Please pass "
|
"using tensorflow < 2.0. Please pass "
|
||||||
"capture_session=True in Interface to avoid "
|
"capture_session=True in Interface to avoid "
|
||||||
"a 'Tensor is not an element of this graph.' "
|
"the 'Tensor is not an element of this graph.' "
|
||||||
"error.")
|
"error.")
|
||||||
prediction = predict_fn(*processed_input)
|
prediction = predict_fn(*processed_input)
|
||||||
|
else:
|
||||||
|
prediction = predict_fn(*processed_input)
|
||||||
|
|
||||||
if len(self.output_interfaces) / \
|
if len(self.output_interfaces) / \
|
||||||
len(self.predict) == 1:
|
len(self.predict) == 1:
|
||||||
|
Loading…
Reference in New Issue
Block a user