-6

I copied the Python code that Google Cloud recommends. I've tried it in Jupyter Notebook and as a Python file but I still get the syntax error:

def predict(content, project_id, model_id):
    # More code.
    pass

print predict("1.jpg", ispace-254720,  ICN886814670746214838)

Gives:

  File "<ipython-input-16-a9c7141e2bf3>", line 1
    print predict("1.jpg", ispace-254720,  ICN886814670746214838)
                ^
SyntaxError: invalid syntax
Kalana
  • 5,631
  • 7
  • 30
  • 51

1 Answers1

2

It's probably old Python 2.7 code. I'm guessing you're using Python 3, in which case print is now a function, so you need to put parentheses after print:

print(predict("1.jpg", ispace-254720,  ICN886814670746214838))
Matt Hall
  • 7,614
  • 1
  • 23
  • 36