0
votes

On providing a local path to the Google Cloud Video Intelligence Api for a Video file to be processed for labels (CODE),it gave a syntax error.All relevant files are stored in the same folder.Which other possible syntax can be used or does one have to upload video files to the Cloud for processing?

Mode                LastWriteTime         Length Name
----                -------------         ------ ----
d-----       25-07-2019     18:45                other
-a----       25-07-2019     17:20           2315 NykyVideoApi-5504e860576e.json
-a----       25-07-2019     17:24       47906730 sampleVid.m4v
-a----       25-07-2019     18:48           1808 VideoLabels.py  

SYNTAX 1

   PS D:\Script\GCloud> d:\Script\GCloud\VideoLabels.py
  File "D:\Script\GCloud\VideoLabels.py", line 7
    def analyze_labels('sampleVid.m4v'):
                                     ^
SyntaxError: invalid syntax  

SYNTAX 2

PS D:\Script\GCloud> d:\Script\GCloud\VideoLabels.py
  File "D:\Script\GCloud\VideoLabels.py", line 7
    def analyze_labels('D:\Script\GCloud\sampleVid.m4v'):
                                                      ^
SyntaxError: invalid syntax
2

2 Answers

0
votes

When you are passing values to a function it literally expects you to use them inside (or there is no point of passing the values) so you cannot use the values if you don't assign it to a variable.

Just do this and you are good to go

def analyze_labels(a = 'sampleVid.m4v'):
  # use the variable 'a' 
   print(a)  #should work.

def analyze_labels(a = 'D:\Script\GCloud\sampleVid.m4v'):
    return a #should work.
0
votes

In the documentation you referenced it says which means your file needs to be in Cloud Storage and not your local directory:

Takes a video file stored in Google Cloud Storage URI as an argument and passes it to the main() function

You need to upload your file to Google Cloud Storage and use the GCS URI (e.g. "gs://[bucket_name]/[path to file]/[filename]", "gs://yourbucket/sampleVid.m4v")