-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d15f408
commit 603f796
Showing
20 changed files
with
356 additions
and
28 deletions.
There are no files selected for viewing
This file contains 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 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 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,23 @@ | ||
import 'package:google_vision/google_vision.dart'; | ||
|
||
void main() async { | ||
final googleVision = | ||
await GoogleVision.withJwt('example/skc-live-decbd0969cbb.json'); | ||
|
||
final painter = Painter.fromFilePath('example/structures.png'); | ||
|
||
final requests = AnnotationRequests(requests: [ | ||
AnnotationRequest( | ||
image: Image(painter: painter), | ||
features: [Feature(maxResults: 10, type: 'WEB_DETECTION')]) | ||
]); | ||
|
||
print('checking...'); | ||
|
||
AnnotatedResponses annotatedResponses = | ||
await googleVision.annotate(requests: requests); | ||
|
||
print(annotatedResponses); | ||
|
||
print('done.\n'); | ||
} |
This file contains 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 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 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 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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,46 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
import 'web_entity.dart'; | ||
import 'web_image.dart'; | ||
import 'web_label.dart'; | ||
import 'web_page.dart'; | ||
|
||
part 'web_detection.g.dart'; | ||
|
||
/// Relevant information for the image from the Internet. | ||
@JsonSerializable() | ||
class WebDetection { | ||
/// Entity deduced from similar images on the Internet. | ||
final List<WebEntity>? webEntities; | ||
|
||
/// Fully matching images from the Internet. | ||
final List<WebImage>? fullMatchingImages; | ||
|
||
/// Partial matching images from the Internet. | ||
final List<WebImage>? partialMatchingImages; | ||
|
||
final List<WebPage>? pagesWithMatchingImages; | ||
|
||
final List<WebImage>? visuallySimilarImages; | ||
|
||
final List<WebLabel>? bestGuessLabels; | ||
|
||
WebDetection({ | ||
this.webEntities, | ||
this.fullMatchingImages, | ||
this.partialMatchingImages, | ||
this.pagesWithMatchingImages, | ||
this.visuallySimilarImages, | ||
this.bestGuessLabels, | ||
}); | ||
|
||
factory WebDetection.fromJson(Map<String, dynamic> json) => | ||
_$WebDetectionFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$WebDetectionToJson(this); | ||
|
||
@override | ||
String toString() => jsonEncode(toJson()); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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,33 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'web_entity.g.dart'; | ||
|
||
/// Entity deduced from similar images on the Internet. | ||
@JsonSerializable() | ||
class WebEntity { | ||
/// Opaque entity ID. | ||
final String entityId; | ||
|
||
/// Overall relevancy score for the entity. Not normalized and not comparable | ||
/// across different image queries. | ||
final num score; | ||
|
||
/// Canonical description of the entity, in English. | ||
final String description; | ||
|
||
WebEntity({ | ||
required this.entityId, | ||
required this.score, | ||
required this.description, | ||
}); | ||
|
||
factory WebEntity.fromJson(Map<String, dynamic> json) => | ||
_$WebEntityFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$WebEntityToJson(this); | ||
|
||
@override | ||
String toString() => jsonEncode(toJson()); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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,28 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'web_image.g.dart'; | ||
|
||
/// Metadata for online images. | ||
@JsonSerializable() | ||
class WebImage { | ||
/// The result image URL. | ||
final String url; | ||
|
||
/// (Deprecated) Overall relevancy score for the image. | ||
final num? score; | ||
|
||
WebImage({ | ||
required this.url, | ||
required this.score, | ||
}); | ||
|
||
factory WebImage.fromJson(Map<String, dynamic> json) => | ||
_$WebImageFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$WebImageToJson(this); | ||
|
||
@override | ||
String toString() => json.encode(toJson()); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 @@ | ||
import 'dart:convert'; | ||
|
||
import 'package:json_annotation/json_annotation.dart'; | ||
|
||
part 'web_label.g.dart'; | ||
|
||
/// Label to provide extra metadata for the web detection. | ||
@JsonSerializable() | ||
class WebLabel { | ||
/// Label for extra metadata. | ||
final String label; | ||
|
||
/// The BCP-47 language code for label, such as "en-US" or "sr-Latn". For more | ||
/// information, see http://www.unicode.org/reports/tr35/#Unicode_locale_identifier. | ||
final String? languageCode; | ||
|
||
WebLabel({ | ||
required this.label, | ||
this.languageCode, | ||
}); | ||
|
||
factory WebLabel.fromJson(Map<String, dynamic> json) => | ||
_$WebLabelFromJson(json); | ||
|
||
Map<String, dynamic> toJson() => _$WebLabelToJson(this); | ||
|
||
@override | ||
String toString() => json.encode(toJson()); | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.