File tree 1 file changed +9
-3
lines changed
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1564,7 +1564,7 @@ def predict(
1564
1564
json_response = raw_predict_response .json ()
1565
1565
return Prediction (
1566
1566
predictions = json_response ["predictions" ],
1567
- metadata = json_response [ "metadata" ] ,
1567
+ metadata = json_response . get ( "metadata" ) ,
1568
1568
deployed_model_id = raw_predict_response .headers [
1569
1569
_RAW_PREDICT_DEPLOYED_MODEL_ID_KEY
1570
1570
],
@@ -1582,7 +1582,10 @@ def predict(
1582
1582
parameters = parameters ,
1583
1583
timeout = timeout ,
1584
1584
)
1585
- metadata = json_format .MessageToDict (prediction_response ._pb .metadata )
1585
+ if prediction_response ._pb .metadata :
1586
+ metadata = json_format .MessageToDict (prediction_response ._pb .metadata )
1587
+ else :
1588
+ metadata = None
1586
1589
1587
1590
return Prediction (
1588
1591
predictions = [
@@ -1643,7 +1646,10 @@ async def predict_async(
1643
1646
parameters = parameters ,
1644
1647
timeout = timeout ,
1645
1648
)
1646
- metadata = json_format .MessageToDict (prediction_response ._pb .metadata )
1649
+ if prediction_response ._pb .metadata :
1650
+ metadata = json_format .MessageToDict (prediction_response ._pb .metadata )
1651
+ else :
1652
+ metadata = None
1647
1653
1648
1654
return Prediction (
1649
1655
predictions = [
You can’t perform that action at this time.
0 commit comments