forked from blakeblackshear/frigate
-
Notifications
You must be signed in to change notification settings - Fork 0
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
POC: Frigate HTTP API using FastAPI #1
Closed
Closed
Conversation
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
* Initial re-implementation of semantic search * put docker-compose back and make reindex match docs * remove debug code and fix import * fix docs * manually build pysqlite3 as binaries are only available for x86-64 * update comment in build_pysqlite3.sh * only embed objects * better error handling when genai fails * ask ollama to pull requested model at startup * update ollama docs * address some PR review comments * fix lint * use IPC to write description, update docs for reindex * remove gemini-pro-vision from docs as it will be unavailable soon * fix OpenAI doc available models * fix api error in gemini and metadata for embeddings
* initial event search api implementation * fix lint * fix tests * move chromadb imports and pysqlite hotswap to fix tests * remove unused import * switch default limit to 50 * fix events accidently pulling inside chroma results loop
* Add basic search page * Abstract filters to separate components * Make searching functional * Add loading and no results indicators * Implement searching * Combine account and settings menus on mobile * Support using thumbnail for in progress detections * Fetch previews * Move recordings view and open recordings when search is selected * Implement detail pane * Implement saving of description * Implement similarity search * Fix clicking * Add date range picker * Fix * Fix iOS zoom bug * Mobile fixes * Use text area * Fix spacing for drawer * Fix fetching previews incorrectly
* Chroma logs in frontend * fix lint
* Initial support for Hailo-8L Added file for Hailo-8L detector including dockerfile, h8l.mk, h8l.hcl, hailo8l.py, ci.yml and ssd_mobilenat_v1.hef as the inference network. Added files to help with the installation of Hailo-8L dependences like generate_wheel_conf.py, requirements-wheel-h8l.txt and modified setup.py to try and work with any hardware. Updated docs to reflect Initial Hailo-8L support including oject_detectors.md, hardware.md and installation.md. * Update .github/workflows/ci.yml typo h8l not arm64 Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com> * Update docs/docs/configuration/object_detectors.md Clarity for the end user and correct uses of words Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com> * Update docs/docs/frigate/installation.md typo Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com> * update Installation.md to clarify Hailo-8L installation process. * Update docs/docs/frigate/hardware.md Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> * Update hardware.md add Inference time. * Oops no new line at the end of the file. * Update docs/docs/frigate/hardware.md typo Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com> * Update dockerfile to download the ssd_modilenet_v1 model instead of having it in the repo. * Updated dockerfile so it dose not download the model file. add function to download it at runtime. update model path. * fix formatting according to ruff and removed unnecessary functions. --------- Co-authored-by: Nicolas Mowen <nickmowen213@gmail.com> Co-authored-by: Josh Hawkins <32435876+hawkeye217@users.noreply.github.com>
* Setup basic notification page * Add basic notification implementation * Register for push notifications * Implement dispatching * Add fields * Handle image and link * Add notification config * Add field for users notification tokens * Implement saving of notification tokens * Implement VAPID key generation * Implement public key encoding * Implement webpush from server * Implement push notification handling * Make notifications config only * Add maskable icon * Use zod form to control notification settings in the UI * Use js * Always open notification * Support multiple endpoints * Handle cleaning up expired notification registrations * Correctly unsubscribe notifications * Change ttl dynamically * Add note about notification latency and features * Cleanup docs * Fix firefox pushes * Add links to docs and improve formatting * Improve wording * Fix docstring Co-authored-by: Blake Blackshear <blake@frigate.video> * Handle case where native auth is not enabled * Show errors in UI --------- Co-authored-by: Blake Blackshear <blake@frigate.video>
* Disable semantic search by default and don't start processes unless enabled * Conditionally create embeddings * Fix typing
* Support building docker image for amd64 and arm64 * Support installations on amd64 and arm64 * Run build in new job * Update docs
* Use review item thumbnail for export * Formatting
…hear#13071) * Add ability to submit to frigate+ from review panel * Add separator * Use consistent ID
# Conflicts: # frigate/api/app.py # web/src/pages/Logs.tsx
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
FastAPI POC
This is a POC of using FastAPI to replace Flask in Frigate HTTP API. It is using the defaults provided by FastAPI (uvicorn and starlette). This was discussed here. The intent is not to be merged right away but rather to further the discussion and to get your feedback on my proposals at the end of this description.
I'm proposing that we add the FastAPI app mount the existing Flask app as a sub-application + 2. This means that the entire application still works as is and we can then start moving endpoint by endpoint to FastAPI until we get to a point where all endpoints are converted. At that point, we can remove Flask altogether.
I've started the conversion of 2-3 endpoints to showcase how it works:
/preview/{camera_name}/start/{start_ts}/end/{end_ts}
/preview/{camera_name}/start/{start_ts}/end/{end_ts}/frames
/{camera_name}/latest.{extension}
-> See warning below/logs/{service}
Here it is working with FastAPI
converted_file.mp4
HTTP API Documentation
Without any extra effort, the swagger documentation is available at
http://localhost:5001/docs
orhttp://localhost:5001/redoc
See documentationSee image && video
converted_file.mp4
The JSON/YAML schema can then be used to feed the HTTP API page without any human interaction.
Problems faced
Caution
I've faced a problem with the existing endpoints which have an extension suffix:⚠️ This lines in
.(jpg|jpeg|png|webp|gif)
.As a resultnginx.conf
was commented out. I've left a comment explaining the errors. If someone wants/can help me figure out why it is failing, then use my branch to debug the endpoints that contain an extension.Proposal(s):
My main proposal is (assuming we can get the nginx problem I've faced resolved):
Other proposals:
Details
By being specific the endpoint will fail if invoked with invalid parameters
and we also get extra auto-complete on the docs
Add prefix to API endpoints e.g. media related endpoints should be
/api/media/...
this avoid any conflict between endpoints and makes it easier to read and more "RESTFUL".i.e., the following should all be `/api/media/...`
Split
app.py
file into multiple other route files:config.py
timeline.py
logs.py
stats
/version
/restart
/etc) tolifecycle.py
Proposals 2 and 3 probably should be left out for future implementation to avoid scope creep