Skip to content

Commit bbd4647

Browse files
committed
Changing v3 to v4, moving import at the top
tensorflow/models#523
1 parent 91d18a6 commit bbd4647

File tree

1 file changed

+7
-4
lines changed
  • tika-parsers/src/main/resources/org/apache/tika/parser/recognition/tf

1 file changed

+7
-4
lines changed

tika-parsers/src/main/resources/org/apache/tika/parser/recognition/tf/inceptionapi.py

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@
3838
import sys
3939
import tarfile
4040

41+
try:
42+
#This import is placed inside here to ensure that video_util and OpenCV is not required for image recognition APIs
43+
from video_util import get_center_frame, get_frames_interval, get_n_frames
44+
except:
45+
print("Can't import video libraries, No video functionality is available")
46+
4147
import numpy as np
4248
from six.moves import urllib
4349
import tensorflow as tf
@@ -404,7 +410,7 @@ def classify_image():
404410

405411
ALLOWED_MODE = set([CENTER ,INTERVAL , FIXED])
406412

407-
@app.route("/inception/v3/classify/video", methods=["GET", "POST"])
413+
@app.route("/inception/v4/classify/video", methods=["GET", "POST"])
408414
def classify_video():
409415
"""
410416
API to classify videos
@@ -421,9 +427,6 @@ def classify_video():
421427
422428
ext - If video is sent in binary format, then ext is needed to tell OpenCV which decoder to use. eg ".mp4"
423429
"""
424-
#This import is placed here to ensure that video_util and OpenCV is not required for image recognition APIs
425-
#It will be imported only once during first API call and so first call could be slow
426-
from video_util import get_center_frame, get_frames_interval, get_n_frames
427430

428431
st = current_time()
429432
topk = int(request.args.get("topk", "10"))

0 commit comments

Comments
 (0)