This repository was archived by the owner on Jan 27, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
feat: generic Inference infrastructure #120
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import 'dart:async'; | ||
|
|
||
| abstract class Repository<I, O> { | ||
| final StreamController<I> _streamController; | ||
| var count = 0; | ||
| Repository() : _streamController = StreamController.broadcast(); | ||
|
|
||
| Stream<I> get stream => _streamController.stream; | ||
|
|
||
| void add(I data) { | ||
| if (!_streamController.isClosed) { | ||
| count = 0; | ||
| _streamController.add(data); | ||
| } | ||
| } | ||
|
|
||
| Future<void> initialize(); | ||
| Future<O?> predict(I input, Map<String, dynamic>? params); | ||
| Future<void> store(I input, O output, Map<String, dynamic>? params); | ||
|
|
||
| void dispose() { | ||
| _streamController.close(); | ||
| } | ||
| } |
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
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 |
|---|---|---|
| @@ -1,46 +1,46 @@ | ||
| part of 'inference_bloc.dart'; | ||
|
|
||
| abstract class InferenceEvent extends Equatable { | ||
| abstract class InferenceEvent<I, O> extends Equatable { | ||
| const InferenceEvent(); | ||
|
|
||
| @override | ||
| List<Object?> get props => []; | ||
| } | ||
|
|
||
| class InferenceInit extends InferenceEvent { | ||
| class InferenceInit<I, O> extends InferenceEvent<I, O> { | ||
| const InferenceInit(); | ||
| } | ||
|
|
||
| class InferenceStart extends InferenceEvent { | ||
| class InferenceStart<I, O> extends InferenceEvent<I, O> { | ||
| final double ratio; | ||
| const InferenceStart(this.ratio); | ||
| } | ||
|
|
||
| class InferenceToggle extends InferenceEvent { | ||
| class InferenceToggle<I, O> extends InferenceEvent<I, O> { | ||
| final bool classification; | ||
| const InferenceToggle(this.classification); | ||
| } | ||
|
|
||
| class InferenceInput extends InferenceEvent { | ||
| final CameraImage input; | ||
| class InferenceInput<I, O> extends InferenceEvent<I, O> { | ||
| final I input; | ||
| final double ratio; | ||
| const InferenceInput({required this.input, required this.ratio}); | ||
|
|
||
| @override | ||
| List<Object> get props => [input]; | ||
| List<Object> get props => [input.toString()]; | ||
| } | ||
|
|
||
| class InferenceOutput extends InferenceEvent { | ||
| final CameraImage input; | ||
| class InferenceOutput<I, O> extends InferenceEvent<I, O> { | ||
| final I input; | ||
| final double ratio; | ||
| final AiModelOutput? output; | ||
| final O? output; | ||
| const InferenceOutput( | ||
| {required this.input, required this.ratio, required this.output}); | ||
|
|
||
| @override | ||
| List<Object?> get props => [output]; | ||
| } | ||
|
|
||
| class InferenceEnd extends InferenceEvent { | ||
| class InferenceEnd<I, O> extends InferenceEvent<I, O> { | ||
| const InferenceEnd(); | ||
| } |
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
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
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.
Uh oh!
There was an error while loading. Please reload this page.