Class TensorflowRESTCaptioner
- java.lang.Object
-
- org.apache.tika.parser.captioning.tf.TensorflowRESTCaptioner
-
- All Implemented Interfaces:
org.apache.tika.config.Initializable,ObjectRecogniser
public class TensorflowRESTCaptioner extends Object implements ObjectRecogniser
Tensorflow image captioner. This implementation uses Tensorflow via REST API.NOTE : https://wiki.apache.org/tika/ImageCaption
- Since:
- Apache Tika 1.17
-
-
Constructor Summary
Constructors Constructor Description TensorflowRESTCaptioner()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckInitialization(org.apache.tika.config.InitializableProblemHandler handler)protected URIgetApiUri(org.apache.tika.metadata.Metadata metadata)Set<org.apache.tika.mime.MediaType>getSupportedMimes()The mimes supported by this recogniservoidinitialize(Map<String,org.apache.tika.config.Param> params)This is the hook for configuring the recogniserbooleanisAvailable()Is this service availableList<CaptionObject>recognise(InputStream stream, ContentHandler handler, org.apache.tika.metadata.Metadata metadata, org.apache.tika.parser.ParseContext context)Recognise the objects in the stream
-
-
-
Method Detail
-
getApiUri
protected URI getApiUri(org.apache.tika.metadata.Metadata metadata)
-
getSupportedMimes
public Set<org.apache.tika.mime.MediaType> getSupportedMimes()
Description copied from interface:ObjectRecogniserThe mimes supported by this recogniser- Specified by:
getSupportedMimesin interfaceObjectRecogniser- Returns:
- set of mediatypes
-
isAvailable
public boolean isAvailable()
Description copied from interface:ObjectRecogniserIs this service available- Specified by:
isAvailablein interfaceObjectRecogniser- Returns:
truewhen the service is available,falseotherwise
-
initialize
public void initialize(Map<String,org.apache.tika.config.Param> params) throws org.apache.tika.exception.TikaConfigException
Description copied from interface:ObjectRecogniserThis is the hook for configuring the recogniser- Specified by:
initializein interfaceorg.apache.tika.config.Initializable- Specified by:
initializein interfaceObjectRecogniser- Parameters:
params- configuration instance in the form of context- Throws:
org.apache.tika.exception.TikaConfigException- when there is an issue with configuration
-
checkInitialization
public void checkInitialization(org.apache.tika.config.InitializableProblemHandler handler) throws org.apache.tika.exception.TikaConfigException- Specified by:
checkInitializationin interfaceorg.apache.tika.config.Initializable- Throws:
org.apache.tika.exception.TikaConfigException
-
recognise
public List<CaptionObject> recognise(InputStream stream, ContentHandler handler, org.apache.tika.metadata.Metadata metadata, org.apache.tika.parser.ParseContext context) throws IOException, SAXException, org.apache.tika.exception.TikaException
Description copied from interface:ObjectRecogniserRecognise the objects in the stream- Specified by:
recognisein interfaceObjectRecogniser- Parameters:
stream- content streamhandler- tika's content handlermetadata- metadata instancecontext- parser context- Returns:
- List of
RecognisedObjects - Throws:
IOException- when an I/O error occursSAXException- when an issue with XML occursorg.apache.tika.exception.TikaException- any generic error
-
-