-
Notifications
You must be signed in to change notification settings - Fork 2
Update Visual Recognition and add new services #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
tfederico
wants to merge
18
commits into
Augugrumi:master
Choose a base branch
from
tfederico:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
7d348e8
Add utility for building a custom classifier
tfederico ba60620
Update all the IBM classes to the currect SDK version
tfederico 3e57cb5
Update all the IBM classes to the currect SDK version
tfederico 0ec5fb2
Fix test and classes
tfederico dee953a
Merge branch 'develop' of github.com:tfederico/libris into develop
tfederico 29dbe26
Add classify feature
tfederico 6cb8bf2
Merge pull request #1 from tfederico/develop
tfederico 9cc0d87
Update package name
tfederico 23e9f8b
Add Discovery utility
tfederico a0c4376
Add natural language understanding utility
tfederico 45dff06
Merge branch 'master' of github.com:tfederico/libris
tfederico fb46b33
Add todo
tfederico cbca2c6
Fix custom image classifier
tfederico a38bfb3
Merge branch 'develop'
tfederico 4ec40a2
Remove api key login and substitute with username and password
tfederico a21b4a5
Merge branch 'develop'
tfederico 06d2fe2
Add multiple id classifiers
tfederico ea4efbd
Merge branch 'develop'
tfederico File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -4,9 +4,9 @@ | |
| xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> | ||
| <modelVersion>4.0.0</modelVersion> | ||
|
|
||
| <groupId>it.polpetta</groupId> | ||
| <groupId>com.tfederico</groupId> | ||
| <artifactId>libris</artifactId> | ||
| <version>2.0.1</version> | ||
| <version>2.3</version> | ||
| <packaging>jar</packaging> | ||
|
|
||
| <name>Reverse Image Search Lib</name> | ||
|
|
@@ -21,7 +21,7 @@ | |
| </licenses> | ||
|
|
||
| <scm> | ||
| <url>https://github.com/Polpetta/libris</url> | ||
| <url>https://github.com/tfederico/libris</url> | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This has to be |
||
| </scm> | ||
|
|
||
| <properties> | ||
|
|
@@ -100,7 +100,7 @@ | |
| <dependency> | ||
| <groupId>com.ibm.watson.developer_cloud</groupId> | ||
| <artifactId>java-sdk</artifactId> | ||
| <version>3.8.0</version> | ||
| <version>4.1.0</version> | ||
|
|
||
| </dependency> | ||
|
|
||
|
|
||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,57 @@ | ||
| package com.tfederico.libris; | ||
|
|
||
| import com.ibm.watson.developer_cloud.natural_language_understanding.v1.model.KeywordsResult; | ||
| import com.ibm.watson.developer_cloud.visual_recognition.v3.model.ClassifiedImage; | ||
| import com.ibm.watson.developer_cloud.visual_recognition.v3.model.ClassifiedImages; | ||
| import com.ibm.watson.developer_cloud.visual_recognition.v3.model.Classifier; | ||
| import com.tfederico.libris.image.ibm.contract.IIBMCustomClassifierUtility; | ||
| import com.tfederico.libris.image.ibm.visualRecognition.IBMCustomClassifierUtility; | ||
| import com.tfederico.libris.text.naturalLanguageUnderstanding.contract.IIBMNaturalLanguageUnderstandingUtility; | ||
| import com.tfederico.libris.text.naturalLanguageUnderstanding.ibm.IBMNaturalLanguageUnderstandingUtility; | ||
|
|
||
| import java.io.FileNotFoundException; | ||
| import java.io.IOException; | ||
| import java.util.List; | ||
|
|
||
| public class Main { | ||
| public static void main(String[] args) { | ||
| IBMCustomClassifierUtility.setSubscriptionKey(""); | ||
| IIBMCustomClassifierUtility customClassifierUtility = new IBMCustomClassifierUtility(); | ||
|
|
||
| /*List<Classifier> classifiersList = customClassifierUtility.getClassifiersList(); | ||
| for(Classifier c : classifiersList) | ||
| customClassifierUtility.deleteClassifier(c.getClassifierId());*/ | ||
|
|
||
| /*ClassifiedImages image = null; | ||
| try { | ||
| image = customClassifierUtility.classify("/home/federico/Downloads/hello.jpg"); | ||
| } catch (FileNotFoundException e) { | ||
| e.printStackTrace(); | ||
| } catch (IOException e) { | ||
| e.printStackTrace(); | ||
| } | ||
|
|
||
| if(image != null){ | ||
| System.out.println(image.getImages().get(0).getClassifiers().get(0).getName()); | ||
| }*/ | ||
|
|
||
| IBMNaturalLanguageUnderstandingUtility | ||
| .setUsernameAndPassword("", | ||
| ""); | ||
|
|
||
| IIBMNaturalLanguageUnderstandingUtility nlu = new IBMNaturalLanguageUnderstandingUtility(); | ||
| String s = "The young sitter is assumed to be Maria Trip, the daughter of a wealthy " + | ||
| "Amsterdam merchant. She displaysher wealth with pride. Her dress is trimmed " + | ||
| "with white linen so fine it is almost transparent. She sports a fortune in " + | ||
| "pearls, and in her left hand she casually holds the knobbed handle of a folding " + | ||
| "fan. In 1639 thiswas still a rare and costly accessory.\n"; | ||
| List<KeywordsResult> keywordsResults = nlu.getKeywordsFromText(s); | ||
|
|
||
| for(KeywordsResult k : keywordsResults){ | ||
| System.out.println(k.getText()); | ||
| System.out.println(k.getRelevance()); | ||
| } | ||
|
|
||
|
|
||
| } | ||
| } |
2 changes: 1 addition & 1 deletion
2
.../libris/contract/AbstractURLSearcher.java → .../libris/contract/AbstractURLSearcher.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...AbstractFactoryReverseSearchProvider.java → ...AbstractFactoryReverseSearchProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...lpetta/libris/contract/IQueryBuilder.java → ...derico/libris/contract/IQueryBuilder.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...lpetta/libris/contract/ISearchResult.java → ...derico/libris/contract/ISearchResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
...t/polpetta/libris/contract/ISearcher.java → .../tfederico/libris/contract/ISearcher.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
20 changes: 10 additions & 10 deletions
20
...etta/libris/image/ReverseImageSearch.java → ...rico/libris/image/ReverseImageSearch.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 3 additions & 4 deletions
7
...ris/image/azure/AzureAbstractFactory.java → ...ris/image/azure/AzureAbstractFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...ureImageFactoryReverseSearchProvider.java → ...ureImageFactoryReverseSearchProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...ure/contract/IAzureImageSearchResult.java → ...ure/contract/IAzureImageSearchResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
...e/azure/contract/IAzureImageSearcher.java → ...e/azure/contract/IAzureImageSearcher.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...geRecognition/AzureImageSearchResult.java → ...geRecognition/AzureImageSearchResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
...ageRecognition/URLAzureImageSearcher.java → ...ageRecognition/URLAzureImageSearcher.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...ge/contract/AbstractURLImageSearcher.java → ...ge/contract/AbstractURLImageSearcher.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...actImageFactoryReverseSearchProvider.java → ...actImageFactoryReverseSearchProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...is/image/contract/IImageQueryBuilder.java → ...is/image/contract/IImageQueryBuilder.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...is/image/contract/IImageSearchResult.java → ...is/image/contract/IImageSearchResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...s/image/google/GoogleAbstractFactory.java → ...s/image/google/GoogleAbstractFactory.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...gleImageFactoryReverseSearchProvider.java → ...gleImageFactoryReverseSearchProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
...le/contract/IGoogleImageSearchResult.java → ...le/contract/IGoogleImageSearchResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 2 additions & 3 deletions
5
...google/contract/IGoogleImageSearcher.java → ...google/contract/IGoogleImageSearcher.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
...lImageSearch/GoogleImageSearchResult.java → ...lImageSearch/GoogleImageSearchResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 6 additions & 6 deletions
12
...tlImageSearch/URLGoogleImageSearcher.java → ...tlImageSearch/URLGoogleImageSearcher.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 3 additions & 3 deletions
6
...IBMImageFactoryReverseSearchProvider.java → ...IBMImageFactoryReverseSearchProvider.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
29 changes: 29 additions & 0 deletions
29
src/main/java/com/tfederico/libris/image/ibm/contract/IIBMCustomClassifierUtility.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| package com.tfederico.libris.image.ibm.contract; | ||
|
|
||
| import com.ibm.watson.developer_cloud.visual_recognition.v3.model.ClassifiedImages; | ||
| import com.ibm.watson.developer_cloud.visual_recognition.v3.model.Classifier; | ||
|
|
||
| import java.io.FileNotFoundException; | ||
| import java.io.IOException; | ||
| import java.util.ArrayList; | ||
| import java.util.HashMap; | ||
| import java.util.List; | ||
|
|
||
| public interface IIBMCustomClassifierUtility { | ||
|
|
||
| Classifier createClassifier(String name, HashMap<String, String> classesAndPaths, | ||
| ArrayList<String> negativesPaths) throws FileNotFoundException; | ||
|
|
||
| Classifier getClassifierById(String id); | ||
|
|
||
| List<Classifier> getClassifiersList(); | ||
|
|
||
| void deleteClassifier(String id); | ||
|
|
||
| Classifier updateClassifier(String id, HashMap<String, String> classesAndPaths, | ||
| ArrayList<String> negativesPaths) throws FileNotFoundException; | ||
|
|
||
| ClassifiedImages classifyById(ArrayList<String> classifierId, String imagePath) throws IOException; | ||
|
|
||
| ClassifiedImages classify(String imagePath) throws IOException; | ||
| } |
4 changes: 2 additions & 2 deletions
4
...e/ibm/contract/IIBMImageSearchResult.java → ...e/ibm/contract/IIBMImageSearchResult.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🤔